diff options
Diffstat (limited to 'api')
-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 } |