[MM-55595] Use annotated logger in search layer (#25468)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5a4dba8809
Коммит
b2ec1ff8ae
@@ -1149,7 +1149,7 @@ func (th *TestHelper) cleanupTestFile(info *model.FileInfo) error {
|
||||
func (th *TestHelper) MakeUserChannelAdmin(user *model.User, channel *model.Channel) {
|
||||
if cm, err := th.App.Srv().Store().Channel().GetMember(context.Background(), channel.Id, user.Id); err == nil {
|
||||
cm.SchemeAdmin = true
|
||||
if _, err = th.App.Srv().Store().Channel().UpdateMember(cm); err != nil {
|
||||
if _, err = th.App.Srv().Store().Channel().UpdateMember(th.Context, cm); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
@@ -1160,7 +1160,7 @@ func (th *TestHelper) MakeUserChannelAdmin(user *model.User, channel *model.Chan
|
||||
func (th *TestHelper) UpdateUserToTeamAdmin(user *model.User, team *model.Team) {
|
||||
if tm, err := th.App.Srv().Store().Team().GetMember(th.Context, team.Id, user.Id); err == nil {
|
||||
tm.SchemeAdmin = true
|
||||
if _, err = th.App.Srv().Store().Team().UpdateMember(tm); err != nil {
|
||||
if _, err = th.App.Srv().Store().Team().UpdateMember(th.Context, tm); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
@@ -1171,7 +1171,7 @@ func (th *TestHelper) UpdateUserToTeamAdmin(user *model.User, team *model.Team)
|
||||
func (th *TestHelper) UpdateUserToNonTeamAdmin(user *model.User, team *model.Team) {
|
||||
if tm, err := th.App.Srv().Store().Team().GetMember(th.Context, team.Id, user.Id); err == nil {
|
||||
tm.SchemeAdmin = false
|
||||
if _, err = th.App.Srv().Store().Team().UpdateMember(tm); err != nil {
|
||||
if _, err = th.App.Srv().Store().Team().UpdateMember(th.Context, tm); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -28,7 +28,7 @@ func purgeBleveIndexes(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := c.App.PurgeBleveIndexes(); err != nil {
|
||||
if err := c.App.PurgeBleveIndexes(c.AppContext); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func patchBot(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
updatedBot, appErr := c.App.PatchBot(botUserId, botPatch)
|
||||
updatedBot, appErr := c.App.PatchBot(c.AppContext, botUserId, botPatch)
|
||||
if appErr != nil {
|
||||
c.Err = appErr
|
||||
return
|
||||
|
||||
@@ -49,7 +49,7 @@ func testElasticsearch(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := c.App.TestElasticsearch(cfg); err != nil {
|
||||
if err := c.App.TestElasticsearch(c.AppContext, cfg); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func purgeElasticsearchIndexes(c *Context, w http.ResponseWriter, r *http.Reques
|
||||
return
|
||||
}
|
||||
|
||||
if err := c.App.PurgeElasticsearchIndexes(); err != nil {
|
||||
if err := c.App.PurgeElasticsearchIndexes(c.AppContext); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
@@ -917,7 +917,7 @@ func TestGetFileLink(t *testing.T) {
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
// Hacky way to assign file to a post (usually would be done by CreatePost call)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(fileId, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(th.Context, fileId, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.FileSettings.EnablePublicLink = false })
|
||||
@@ -1075,7 +1075,7 @@ func TestGetPublicFile(t *testing.T) {
|
||||
fileId := fileResp.FileInfos[0].Id
|
||||
|
||||
// Hacky way to assign file to a post (usually would be done by CreatePost call)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(fileId, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(th.Context, fileId, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
info, err := th.App.Srv().Store().FileInfo().Get(fileId)
|
||||
@@ -1140,25 +1140,25 @@ func TestSearchFiles(t *testing.T) {
|
||||
filename := "search for fileInfo1"
|
||||
fileInfo1, appErr := th.App.UploadFile(th.Context, data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, appErr)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(fileInfo1.Id, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(th.Context, fileInfo1.Id, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
filename = "search for fileInfo2"
|
||||
fileInfo2, appErr := th.App.UploadFile(th.Context, data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, appErr)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(fileInfo2.Id, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(th.Context, fileInfo2.Id, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
filename = "tagged search for fileInfo3"
|
||||
fileInfo3, appErr := th.App.UploadFile(th.Context, data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, appErr)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(fileInfo3.Id, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(th.Context, fileInfo3.Id, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
filename = "tagged for fileInfo4"
|
||||
fileInfo4, appErr := th.App.UploadFile(th.Context, data, th.BasicChannel.Id, filename)
|
||||
require.Nil(t, appErr)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(fileInfo4.Id, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(th.Context, fileInfo4.Id, th.BasicPost.Id, th.BasicPost.ChannelId, th.BasicUser.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
archivedChannel := th.CreatePublicChannel()
|
||||
@@ -1167,7 +1167,7 @@ func TestSearchFiles(t *testing.T) {
|
||||
post := &model.Post{ChannelId: archivedChannel.Id, Message: model.NewId() + "a"}
|
||||
rpost, _, err := client.CreatePost(context.Background(), post)
|
||||
require.NoError(t, err)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(fileInfo5.Id, rpost.Id, rpost.ChannelId, th.BasicUser.Id)
|
||||
err = th.App.Srv().Store().FileInfo().AttachToPost(th.Context, fileInfo5.Id, rpost.Id, rpost.ChannelId, th.BasicUser.Id)
|
||||
require.NoError(t, err)
|
||||
th.Client.DeleteChannel(context.Background(), archivedChannel.Id)
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ func applyIPFilters(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
if c.App.License().IsCloud() {
|
||||
portalUserCustomer, cErr := c.App.Cloud().GetCloudCustomer(c.AppContext.Session().UserId)
|
||||
if cErr != nil {
|
||||
mlog.Error("Failed to get portal user customer", mlog.Err(cErr))
|
||||
c.Logger.Error("Failed to get portal user customer", mlog.Err(cErr))
|
||||
}
|
||||
if cErr == nil && portalUserCustomer != nil {
|
||||
cloudWorkspaceOwnerEmailAddress = portalUserCustomer.Email
|
||||
@@ -97,17 +97,17 @@ func applyIPFilters(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
go func() {
|
||||
initiatingUser, err := c.App.Srv().Store().User().GetProfileByIds(context.Background(), []string{c.AppContext.Session().UserId}, nil, true)
|
||||
if err != nil {
|
||||
mlog.Error("Failed to get initiating user", mlog.Err(err))
|
||||
c.Logger.Error("Failed to get initiating user", mlog.Err(err))
|
||||
}
|
||||
|
||||
users, err := c.App.Srv().Store().User().GetSystemAdminProfiles()
|
||||
if err != nil {
|
||||
mlog.Error("Failed to get system admins", mlog.Err(err))
|
||||
c.Logger.Error("Failed to get system admins", mlog.Err(err))
|
||||
}
|
||||
|
||||
for _, user := range users {
|
||||
if err = c.App.Srv().EmailService.SendIPFiltersChangedEmail(user.Email, initiatingUser[0], *c.App.Config().ServiceSettings.SiteURL, *c.App.Config().CloudSettings.CWSURL, user.Locale, cloudWorkspaceOwnerEmailAddress == user.Email); err != nil {
|
||||
mlog.Error("Error while sending IP filters changed email", mlog.Err(err))
|
||||
c.Logger.Error("Error while sending IP filters changed email", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -2253,7 +2253,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
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)
|
||||
_, err = th.App.Srv().Store().Channel().UpdateMember(th.Context, channelMember)
|
||||
require.NoError(t, err)
|
||||
th.App.Srv().Store().Post().InvalidateLastPostTimeCache(channelId)
|
||||
|
||||
@@ -2274,7 +2274,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
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)
|
||||
_, err = th.App.Srv().Store().Channel().UpdateMember(th.Context, channelMember)
|
||||
require.NoError(t, err)
|
||||
th.App.Srv().Store().Post().InvalidateLastPostTimeCache(channelId)
|
||||
|
||||
@@ -2298,7 +2298,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
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)
|
||||
_, err = th.App.Srv().Store().Channel().UpdateMember(th.Context, channelMember)
|
||||
require.NoError(t, err)
|
||||
th.App.Srv().Store().Post().InvalidateLastPostTimeCache(channelId)
|
||||
|
||||
@@ -2325,7 +2325,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
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)
|
||||
_, err = th.App.Srv().Store().Channel().UpdateMember(th.Context, channelMember)
|
||||
require.NoError(t, err)
|
||||
th.App.Srv().Store().Post().InvalidateLastPostTimeCache(channelId)
|
||||
|
||||
@@ -2350,7 +2350,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
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)
|
||||
_, err = th.App.Srv().Store().Channel().UpdateMember(th.Context, channelMember)
|
||||
require.NoError(t, err)
|
||||
th.App.Srv().Store().Post().InvalidateLastPostTimeCache(channelId)
|
||||
|
||||
@@ -2389,7 +2389,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
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)
|
||||
_, err = th.App.Srv().Store().Channel().UpdateMember(th.Context, channelMember)
|
||||
require.NoError(t, err)
|
||||
th.App.Srv().Store().Post().InvalidateLastPostTimeCache(channelId)
|
||||
|
||||
|
||||
@@ -442,7 +442,7 @@ func TestGetChannelsForScheme(t *testing.T) {
|
||||
assert.Zero(t, len(l2))
|
||||
|
||||
channel1.SchemeId = &scheme1.Id
|
||||
channel1, err = th.App.Srv().Store().Channel().Update(channel1)
|
||||
channel1, err = th.App.Srv().Store().Channel().Update(th.Context, channel1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
l3, _, err := th.SystemAdminClient.GetChannelsForScheme(context.Background(), scheme1.Id, 0, 100)
|
||||
|
||||
@@ -1130,7 +1130,7 @@ func searchUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
profiles, appErr := c.App.SearchUsers(&props, options)
|
||||
profiles, appErr := c.App.SearchUsers(c.AppContext, &props, options)
|
||||
if appErr != nil {
|
||||
c.Err = appErr
|
||||
return
|
||||
@@ -1206,7 +1206,7 @@ func autocompleteUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
)
|
||||
return
|
||||
}
|
||||
result, err := c.App.AutocompleteUsersInChannel(teamId, channelId, name, options)
|
||||
result, err := c.App.AutocompleteUsersInChannel(c.AppContext, teamId, channelId, name, options)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -1215,7 +1215,7 @@ func autocompleteUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
autocomplete.Users = result.InChannel
|
||||
autocomplete.OutOfChannel = result.OutOfChannel
|
||||
} else if teamId != "" {
|
||||
result, err := c.App.AutocompleteUsersInTeam(teamId, name, options)
|
||||
result, err := c.App.AutocompleteUsersInTeam(c.AppContext, teamId, name, options)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -1223,7 +1223,7 @@ func autocompleteUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
autocomplete.Users = result.InTeam
|
||||
} else {
|
||||
result, err := c.App.SearchUsersInTeam("", name, options)
|
||||
result, err := c.App.SearchUsersInTeam(c.AppContext, "", name, options)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
|
||||
@@ -6109,7 +6109,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
CheckCreatedStatus(t, resp)
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
|
||||
uss, _, err := th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{})
|
||||
require.NoError(t, err)
|
||||
@@ -6126,7 +6126,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
CheckCreatedStatus(t, resp)
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
|
||||
uss, _, err := th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{})
|
||||
require.NoError(t, err)
|
||||
@@ -6145,7 +6145,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
CheckCreatedStatus(t, resp)
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
|
||||
uss, _, err := th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Extended: true,
|
||||
@@ -6167,7 +6167,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
CheckCreatedStatus(t, resp)
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
|
||||
uss, _, err := th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
@@ -6224,7 +6224,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
|
||||
client := th.Client
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
|
||||
rpost, resp, err := client.CreatePost(context.Background(), &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"})
|
||||
require.NoError(t, err)
|
||||
@@ -6267,7 +6267,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
CheckCreatedStatus(t, resp)
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
|
||||
uss, _, err := th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{})
|
||||
require.NoError(t, err)
|
||||
@@ -6289,7 +6289,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
CheckCreatedStatus(t, resp)
|
||||
}
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
|
||||
uss, _, err := th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
@@ -6316,7 +6316,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
rootIdBefore := rootIds[14].Id
|
||||
rootIdAfter := rootIds[16].Id
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
|
||||
uss, _, err := th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
@@ -6367,8 +6367,8 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
CheckCreatedStatus(t, resp)
|
||||
}
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.SystemAdminUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.SystemAdminUser.Id)
|
||||
|
||||
uss, _, err := th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
@@ -6403,8 +6403,8 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
CheckCreatedStatus(t, resp)
|
||||
}
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.SystemAdminUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.SystemAdminUser.Id)
|
||||
|
||||
uss, _, err := th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
@@ -6426,7 +6426,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("setting both threadsOnly, and totalsOnly params is not allowed", func(t *testing.T) {
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
|
||||
_, resp, err := th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
ThreadsOnly: true,
|
||||
@@ -6553,8 +6553,8 @@ func TestThreadSocketEvents(t *testing.T) {
|
||||
|
||||
replyPost, appErr := th.App.CreatePostAsUser(th.Context, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testReply @" + th.BasicUser.Username, UserId: th.BasicUser2.Id, RootId: rpost.Id}, th.Context.Session().Id, false)
|
||||
require.Nil(t, appErr)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser2.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser2.Id)
|
||||
|
||||
t.Run("Listed for update event", func(t *testing.T) {
|
||||
var caught bool
|
||||
@@ -6815,7 +6815,7 @@ func TestFollowThreads(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
CheckCreatedStatus(t, resp)
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
var uss *model.Threads
|
||||
uss, _, err = th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
@@ -6914,8 +6914,8 @@ func TestMaintainUnreadRepliesInThread(t *testing.T) {
|
||||
})
|
||||
|
||||
client := th.Client
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.SystemAdminUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.SystemAdminUser.Id)
|
||||
|
||||
// create a post by regular user
|
||||
rpost, _ := postAndCheck(t, client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"})
|
||||
@@ -6969,8 +6969,8 @@ func TestThreadCounts(t *testing.T) {
|
||||
})
|
||||
|
||||
client := th.Client
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.SystemAdminUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.SystemAdminUser.Id)
|
||||
|
||||
// create a post by regular user
|
||||
rpost, _ := postAndCheck(t, client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"})
|
||||
@@ -6989,7 +6989,7 @@ func TestThreadCounts(t *testing.T) {
|
||||
})
|
||||
|
||||
// delete first thread
|
||||
th.App.Srv().Store().Post().Delete(rpost.Id, model.GetMillis(), th.BasicUser.Id)
|
||||
th.App.Srv().Store().Post().Delete(th.Context, rpost.Id, model.GetMillis(), th.BasicUser.Id)
|
||||
|
||||
// we should now have 1 thread with 2 replies
|
||||
checkThreadListReplies(t, th, th.Client, th.BasicUser.Id, 2, 1, &model.GetUserThreadsOpts{
|
||||
@@ -7020,8 +7020,8 @@ func TestSingleThreadGet(t *testing.T) {
|
||||
client := th.Client
|
||||
|
||||
t.Run("get single thread", func(t *testing.T) {
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.SystemAdminUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.SystemAdminUser.Id)
|
||||
|
||||
// create a post by regular user
|
||||
rpost, _ := postAndCheck(t, client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"})
|
||||
@@ -7108,8 +7108,8 @@ func TestMaintainUnreadMentionsInThread(t *testing.T) {
|
||||
return uss, resp
|
||||
}
|
||||
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.SystemAdminUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.SystemAdminUser.Id)
|
||||
|
||||
// create regular post
|
||||
rpost, _ := postAndCheck(t, client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"})
|
||||
@@ -7162,7 +7162,7 @@ func TestReadThreads(t *testing.T) {
|
||||
_, resp, err = client.CreatePost(context.Background(), &model.Post{ChannelId: th.BasicChannel.Id, Message: "testReply", RootId: rpost.Id})
|
||||
require.NoError(t, err)
|
||||
CheckCreatedStatus(t, resp)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
|
||||
var uss, uss2 *model.Threads
|
||||
uss, _, err = th.Client.GetUserThreads(context.Background(), th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
@@ -7184,8 +7184,8 @@ func TestReadThreads(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("1 thread by timestamp", func(t *testing.T) {
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.SystemAdminUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.SystemAdminUser.Id)
|
||||
|
||||
rpost, _ := postAndCheck(t, client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsgC1"})
|
||||
postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testReplyC1", RootId: rpost.Id})
|
||||
@@ -7212,8 +7212,8 @@ func TestReadThreads(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("1 thread by post id", func(t *testing.T) {
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.SystemAdminUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.BasicUser.Id)
|
||||
defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.Context, th.SystemAdminUser.Id)
|
||||
|
||||
rpost, _ := postAndCheck(t, client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsgC1"})
|
||||
reply1, _ := postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testReplyC1", RootId: rpost.Id})
|
||||
|
||||
Ссылка в новой задаче
Block a user