unparam lint (#16771)
* fixed: `identifier` is unused lint error * make saveMultipleMembersT method saveMultipleMembers Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
78ccf8a775
Коммит
a63dea6c55
12
api4/bot.go
12
api4/bot.go
@@ -183,15 +183,15 @@ func getBots(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write(bots.ToJson())
|
||||
}
|
||||
|
||||
func disableBot(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
updateBotActive(c, w, r, false)
|
||||
func disableBot(c *Context, w http.ResponseWriter, _ *http.Request) {
|
||||
updateBotActive(c, w, false)
|
||||
}
|
||||
|
||||
func enableBot(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
updateBotActive(c, w, r, true)
|
||||
func enableBot(c *Context, w http.ResponseWriter, _ *http.Request) {
|
||||
updateBotActive(c, w, true)
|
||||
}
|
||||
|
||||
func updateBotActive(c *Context, w http.ResponseWriter, r *http.Request, active bool) {
|
||||
func updateBotActive(c *Context, w http.ResponseWriter, active bool) {
|
||||
c.RequireBotUserId()
|
||||
if c.Err != nil {
|
||||
return
|
||||
@@ -220,7 +220,7 @@ func updateBotActive(c *Context, w http.ResponseWriter, r *http.Request, active
|
||||
w.Write(bot.ToJson())
|
||||
}
|
||||
|
||||
func assignBot(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
func assignBot(c *Context, w http.ResponseWriter, _ *http.Request) {
|
||||
c.RequireUserId()
|
||||
c.RequireBotUserId()
|
||||
if c.Err != nil {
|
||||
|
||||
14
api4/post.go
14
api4/post.go
@@ -372,7 +372,7 @@ func getPost(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(post.ToJson()))
|
||||
}
|
||||
|
||||
func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
func deletePost(c *Context, w http.ResponseWriter, _ *http.Request) {
|
||||
c.RequirePostId()
|
||||
if c.Err != nil {
|
||||
return
|
||||
@@ -639,7 +639,7 @@ func patchPost(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(patchedPost.ToJson()))
|
||||
}
|
||||
|
||||
func setPostUnread(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
func setPostUnread(c *Context, w http.ResponseWriter, _ *http.Request) {
|
||||
c.RequirePostId().RequireUserId()
|
||||
if c.Err != nil {
|
||||
return
|
||||
@@ -661,7 +661,7 @@ func setPostUnread(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(state.ToJson()))
|
||||
}
|
||||
|
||||
func saveIsPinnedPost(c *Context, w http.ResponseWriter, r *http.Request, isPinned bool) {
|
||||
func saveIsPinnedPost(c *Context, w http.ResponseWriter, isPinned bool) {
|
||||
c.RequirePostId()
|
||||
if c.Err != nil {
|
||||
return
|
||||
@@ -717,12 +717,12 @@ func saveIsPinnedPost(c *Context, w http.ResponseWriter, r *http.Request, isPinn
|
||||
ReturnStatusOK(w)
|
||||
}
|
||||
|
||||
func pinPost(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
saveIsPinnedPost(c, w, r, true)
|
||||
func pinPost(c *Context, w http.ResponseWriter, _ *http.Request) {
|
||||
saveIsPinnedPost(c, w, true)
|
||||
}
|
||||
|
||||
func unpinPost(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
saveIsPinnedPost(c, w, r, false)
|
||||
func unpinPost(c *Context, w http.ResponseWriter, _ *http.Request) {
|
||||
saveIsPinnedPost(c, w, false)
|
||||
}
|
||||
|
||||
func getFileInfosForPost(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -5754,7 +5754,8 @@ func TestMaintainUnreadMentionsInThread(t *testing.T) {
|
||||
*cfg.ServiceSettings.ThreadAutoFollow = true
|
||||
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON
|
||||
})
|
||||
checkThreadList := func(client *model.Client4, userId string, expectedMentions, expectedThreads int) (*model.Threads, *model.Response) {
|
||||
|
||||
checkThreadList := func(client *model.Client4, userId string, expectedThreads int) (*model.Threads, *model.Response) {
|
||||
uss, resp := client.GetUserThreads(userId, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
})
|
||||
@@ -5776,34 +5777,33 @@ func TestMaintainUnreadMentionsInThread(t *testing.T) {
|
||||
defer th.App.Srv().Store.Post().PermanentDeleteByUser(th.SystemAdminUser.Id)
|
||||
|
||||
// basic user 1 was mentioned 1 time
|
||||
checkThreadList(th.Client, th.BasicUser.Id, 1, 1)
|
||||
checkThreadList(th.Client, th.BasicUser.Id, 1)
|
||||
// basic user 2 was mentioned 1 time
|
||||
checkThreadList(th.SystemAdminClient, th.BasicUser2.Id, 1, 1)
|
||||
checkThreadList(th.SystemAdminClient, th.BasicUser2.Id, 1)
|
||||
|
||||
// test self mention, shouldn't increase mention count
|
||||
postAndCheck(t, Client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testReply @" + th.BasicUser.Username, RootId: rpost.Id})
|
||||
// count should increase
|
||||
checkThreadList(th.Client, th.BasicUser.Id, 1, 1)
|
||||
checkThreadList(th.Client, th.BasicUser.Id, 1)
|
||||
|
||||
// test DM
|
||||
dm := th.CreateDmChannel(th.SystemAdminUser)
|
||||
dm_root_post, _ := postAndCheck(t, Client, &model.Post{ChannelId: dm.Id, Message: "hi @" + th.SystemAdminUser.Username})
|
||||
|
||||
// no changes
|
||||
checkThreadList(th.Client, th.BasicUser.Id, 1, 1)
|
||||
checkThreadList(th.Client, th.BasicUser.Id, 1)
|
||||
|
||||
// post reply by the same user
|
||||
postAndCheck(t, Client, &model.Post{ChannelId: dm.Id, Message: "how are you", RootId: dm_root_post.Id})
|
||||
|
||||
// thread created
|
||||
checkThreadList(th.Client, th.BasicUser.Id, 1, 2)
|
||||
checkThreadList(th.Client, th.BasicUser.Id, 2)
|
||||
|
||||
// post two replies by another user, without mentions. mention count should still increase since this is a DM
|
||||
postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: dm.Id, Message: "msg1", RootId: dm_root_post.Id})
|
||||
postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: dm.Id, Message: "msg2", RootId: dm_root_post.Id})
|
||||
// expect increment by two mentions
|
||||
checkThreadList(th.Client, th.BasicUser.Id, 3, 2)
|
||||
|
||||
checkThreadList(th.Client, th.BasicUser.Id, 2)
|
||||
}
|
||||
|
||||
func TestReadThreads(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user