[MM-32622] Remove app.WaitForChannelMembership() (#17048)

* Remove app.WaitForChannelMembership

* Fix tests

* Fix test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Claudio Costa
2021-03-31 09:40:35 +02:00
коммит произвёл GitHub
родитель 4ba0c09fc7
Коммит ee3f986da0
32 изменённых файлов: 211 добавлений и 227 удалений

Просмотреть файл

@@ -4,6 +4,7 @@
package api4
import (
"context"
"encoding/json"
"errors"
"fmt"
@@ -1732,7 +1733,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
// Set channel member's last viewed to 0.
// All returned posts are latest posts as if all previous posts were already read by the user.
channelMember, err := th.App.Srv().Store.Channel().GetMember(channelId, userId)
channelMember, err := th.App.Srv().Store.Channel().GetMember(context.Background(), channelId, userId)
require.NoError(t, err)
channelMember.LastViewedAt = 0
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
@@ -1753,7 +1754,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
postIdNames[systemPost1.Id] = "system post 1"
// Set channel member's last viewed before post1.
channelMember, err = th.App.Srv().Store.Channel().GetMember(channelId, userId)
channelMember, err = th.App.Srv().Store.Channel().GetMember(context.Background(), channelId, userId)
require.NoError(t, err)
channelMember.LastViewedAt = post1.CreateAt - 1
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
@@ -1777,7 +1778,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
}, posts)
// Set channel member's last viewed before post6.
channelMember, err = th.App.Srv().Store.Channel().GetMember(channelId, userId)
channelMember, err = th.App.Srv().Store.Channel().GetMember(context.Background(), channelId, userId)
require.NoError(t, err)
channelMember.LastViewedAt = post6.CreateAt - 1
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
@@ -1804,7 +1805,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
}, posts)
// Set channel member's last viewed before post10.
channelMember, err = th.App.Srv().Store.Channel().GetMember(channelId, userId)
channelMember, err = th.App.Srv().Store.Channel().GetMember(context.Background(), channelId, userId)
require.NoError(t, err)
channelMember.LastViewedAt = post10.CreateAt - 1
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
@@ -1829,7 +1830,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
}, posts)
// Set channel member's last viewed equal to post10.
channelMember, err = th.App.Srv().Store.Channel().GetMember(channelId, userId)
channelMember, err = th.App.Srv().Store.Channel().GetMember(context.Background(), channelId, userId)
require.NoError(t, err)
channelMember.LastViewedAt = post10.CreateAt
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
@@ -1869,7 +1870,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
postIdNames[post12.Id] = "post12 (reply to post4)"
postIdNames[post13.Id] = "post13"
channelMember, err = th.App.Srv().Store.Channel().GetMember(channelId, userId)
channelMember, err = th.App.Srv().Store.Channel().GetMember(context.Background(), channelId, userId)
require.NoError(t, err)
channelMember.LastViewedAt = post12.CreateAt - 1
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)