[PLT-4341] add dnd command (#7694)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
f632232862
Коммит
62b3569025
@@ -84,6 +84,8 @@ func updateUserStatus(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.App.SetStatusOffline(c.Params.UserId, true)
|
||||
case "away":
|
||||
c.App.SetStatusAwayIfNeeded(c.Params.UserId, true)
|
||||
case "dnd":
|
||||
c.App.SetStatusDoNotDisturb(c.Params.UserId)
|
||||
default:
|
||||
c.SetInvalidParam("status")
|
||||
return
|
||||
|
||||
@@ -31,6 +31,13 @@ func TestGetUserStatus(t *testing.T) {
|
||||
t.Fatal("Should return away status")
|
||||
}
|
||||
|
||||
th.App.SetStatusDoNotDisturb(th.BasicUser.Id)
|
||||
userStatus, resp = Client.GetUserStatus(th.BasicUser.Id, "")
|
||||
CheckNoError(t, resp)
|
||||
if userStatus.Status != "dnd" {
|
||||
t.Fatal("Should return dnd status")
|
||||
}
|
||||
|
||||
th.App.SetStatusOffline(th.BasicUser.Id, true)
|
||||
userStatus, resp = Client.GetUserStatus(th.BasicUser.Id, "")
|
||||
CheckNoError(t, resp)
|
||||
@@ -93,6 +100,16 @@ func TestGetUsersStatusesByIds(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
th.App.SetStatusDoNotDisturb(th.BasicUser.Id)
|
||||
th.App.SetStatusDoNotDisturb(th.BasicUser2.Id)
|
||||
usersStatuses, resp = Client.GetUsersStatusesByIds(usersIds)
|
||||
CheckNoError(t, resp)
|
||||
for _, userStatus := range usersStatuses {
|
||||
if userStatus.Status != "dnd" {
|
||||
t.Fatal("Status should be offline")
|
||||
}
|
||||
}
|
||||
|
||||
Client.Logout()
|
||||
|
||||
_, resp = Client.GetUsersStatusesByIds(usersIds)
|
||||
@@ -118,6 +135,13 @@ func TestUpdateUserStatus(t *testing.T) {
|
||||
t.Fatal("Should return away status")
|
||||
}
|
||||
|
||||
toUpdateUserStatus.Status = "dnd"
|
||||
updateUserStatus, resp = Client.UpdateUserStatus(th.BasicUser.Id, toUpdateUserStatus)
|
||||
CheckNoError(t, resp)
|
||||
if updateUserStatus.Status != "dnd" {
|
||||
t.Fatal("Should return dnd status")
|
||||
}
|
||||
|
||||
toUpdateUserStatus.Status = "offline"
|
||||
updateUserStatus, resp = Client.UpdateUserStatus(th.BasicUser.Id, toUpdateUserStatus)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
Ссылка в новой задаче
Block a user