diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-11-01 15:50:34 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-11-01 15:50:34 -0400 |
commit | b0f38f8a84ae0b7cba43c7d12a19f8f3cb79e9b0 (patch) | |
tree | 376a9d7ca30c9c917b6864bcf5c0021635a05f66 /api/team.go | |
parent | 60a43a5b4ff1e2f5b8d67419611b8f62d8b5412d (diff) | |
download | chat-b0f38f8a84ae0b7cba43c7d12a19f8f3cb79e9b0.tar.gz chat-b0f38f8a84ae0b7cba43c7d12a19f8f3cb79e9b0.tar.bz2 chat-b0f38f8a84ae0b7cba43c7d12a19f8f3cb79e9b0.zip |
Fixing websocket and team store issues when leaving team (#4412)
Diffstat (limited to 'api/team.go')
-rw-r--r-- | api/team.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/api/team.go b/api/team.go index 46e822504..5a8c605ef 100644 --- a/api/team.go +++ b/api/team.go @@ -347,6 +347,12 @@ func LeaveTeam(team *model.Team, user *model.User) *model.AppError { } } + // Send the websocket message before we actually do the remove so the user being removed gets it. + message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_LEAVE_TEAM, team.Id, "", "", nil) + message.Add("user_id", user.Id) + message.Add("team_id", team.Id) + Publish(message) + teamMember.Roles = "" teamMember.DeleteAt = model.GetMillis() @@ -361,10 +367,6 @@ func LeaveTeam(team *model.Team, user *model.User) *model.AppError { RemoveAllSessionsForUserId(user.Id) InvalidateCacheForUser(user.Id) - message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_LEAVE_TEAM, team.Id, "", "", nil) - message.Add("user_id", user.Id) - go Publish(message) - return nil } |