MM-10254 Add plugin APIs for getting/updating user statuses (#9101)
* Add plugin APIs for getting/updating user statuses * Add and update tests * Updates per feedback
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
88eef609ab
Коммит
275731578e
@@ -64,7 +64,7 @@ func createPost(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
c.App.SetStatusOnline(c.Session.UserId, c.Session.Id, false)
|
||||
c.App.SetStatusOnline(c.Session.UserId, false)
|
||||
c.App.UpdateLastActivityAtIfNeeded(c.Session)
|
||||
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
|
||||
@@ -78,7 +78,7 @@ func updateUserStatus(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
switch status.Status {
|
||||
case "online":
|
||||
c.App.SetStatusOnline(c.Params.UserId, "", true)
|
||||
c.App.SetStatusOnline(c.Params.UserId, true)
|
||||
case "offline":
|
||||
c.App.SetStatusOffline(c.Params.UserId, true)
|
||||
case "away":
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestGetUserStatus(t *testing.T) {
|
||||
t.Fatal("Should return offline status")
|
||||
}
|
||||
|
||||
th.App.SetStatusOnline(th.BasicUser.Id, "", true)
|
||||
th.App.SetStatusOnline(th.BasicUser.Id, true)
|
||||
userStatus, resp = Client.GetUserStatus(th.BasicUser.Id, "")
|
||||
CheckNoError(t, resp)
|
||||
if userStatus.Status != "online" {
|
||||
@@ -80,8 +80,8 @@ func TestGetUsersStatusesByIds(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
th.App.SetStatusOnline(th.BasicUser.Id, "", true)
|
||||
th.App.SetStatusOnline(th.BasicUser2.Id, "", true)
|
||||
th.App.SetStatusOnline(th.BasicUser.Id, true)
|
||||
th.App.SetStatusOnline(th.BasicUser2.Id, true)
|
||||
usersStatuses, resp = Client.GetUsersStatusesByIds(usersIds)
|
||||
CheckNoError(t, resp)
|
||||
for _, userStatus := range usersStatuses {
|
||||
|
||||
@@ -1501,7 +1501,7 @@ func TestGetRecentlyActiveUsersInTeam(t *testing.T) {
|
||||
Client := th.Client
|
||||
teamId := th.BasicTeam.Id
|
||||
|
||||
th.App.SetStatusOnline(th.BasicUser.Id, "", true)
|
||||
th.App.SetStatusOnline(th.BasicUser.Id, true)
|
||||
|
||||
rusers, resp := Client.GetRecentlyActiveUsersInTeam(teamId, 0, 60, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
@@ -404,7 +404,7 @@ func TestWebSocketStatuses(t *testing.T) {
|
||||
time.Sleep(1500 * time.Millisecond)
|
||||
|
||||
th.App.SetStatusAwayIfNeeded(th.BasicUser.Id, false)
|
||||
th.App.SetStatusOnline(th.BasicUser.Id, "junk", false)
|
||||
th.App.SetStatusOnline(th.BasicUser.Id, false)
|
||||
|
||||
time.Sleep(1500 * time.Millisecond)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user