MM-35392 Load thread unreads for other teams on app load (#17944)
* Add ability to include thread unreads in team unreads api response * Do not include GMs/DMs in team unreads for threads * Fix bad merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
04ef406bd6
Коммит
a0cc420e2a
@@ -420,8 +420,9 @@ func getTeamsUnreadForUser(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// optional team id to be excluded from the result
|
||||
teamId := r.URL.Query().Get("exclude_team")
|
||||
includeCollapsedThreads := r.URL.Query().Get("include_collapsed_threads") == "true"
|
||||
|
||||
unreadTeamsList, err := c.App.GetTeamsUnreadForUser(teamId, c.Params.UserId)
|
||||
unreadTeamsList, err := c.App.GetTeamsUnreadForUser(teamId, c.Params.UserId, includeCollapsedThreads)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
|
||||
@@ -2651,22 +2651,22 @@ func TestGetMyTeamsUnread(t *testing.T) {
|
||||
user := th.BasicUser
|
||||
Client.Login(user.Email, user.Password)
|
||||
|
||||
teams, resp := Client.GetTeamsUnreadForUser(user.Id, "")
|
||||
teams, resp := Client.GetTeamsUnreadForUser(user.Id, "", true)
|
||||
CheckNoError(t, resp)
|
||||
require.NotEqual(t, len(teams), 0, "should have results")
|
||||
|
||||
teams, resp = Client.GetTeamsUnreadForUser(user.Id, th.BasicTeam.Id)
|
||||
teams, resp = Client.GetTeamsUnreadForUser(user.Id, th.BasicTeam.Id, true)
|
||||
CheckNoError(t, resp)
|
||||
require.Empty(t, teams, "should not have results")
|
||||
|
||||
_, resp = Client.GetTeamsUnreadForUser("fail", "")
|
||||
_, resp = Client.GetTeamsUnreadForUser("fail", "", true)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
_, resp = Client.GetTeamsUnreadForUser(model.NewId(), "")
|
||||
_, resp = Client.GetTeamsUnreadForUser(model.NewId(), "", true)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
Client.Logout()
|
||||
_, resp = Client.GetTeamsUnreadForUser(user.Id, "")
|
||||
_, resp = Client.GetTeamsUnreadForUser(user.Id, "", true)
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
}
|
||||
|
||||
|
||||
@@ -5551,7 +5551,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
|
||||
require.Nil(t, resp.Error)
|
||||
require.Len(t, uss.Threads, 10)
|
||||
require.Equal(t, uss.Threads[0].PostId, rootIdBefore)
|
||||
require.Equal(t, rootIdBefore, uss.Threads[0].PostId)
|
||||
|
||||
uss2, resp2 := th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
@@ -5561,7 +5561,7 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
require.Nil(t, resp2.Error)
|
||||
require.Len(t, uss2.Threads, 10)
|
||||
|
||||
require.Equal(t, uss2.Threads[0].PostId, rootIdAfter)
|
||||
require.Equal(t, rootIdAfter, uss2.Threads[0].PostId)
|
||||
|
||||
uss3, resp3 := th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
|
||||
Ссылка в новой задаче
Block a user