summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-05-11 08:10:59 -0400
committerGitHub <noreply@github.com>2017-05-11 08:10:59 -0400
commitbe7c53ec7fffaa1751a162f4a34760f94e941bc6 (patch)
tree46299da4de0952ad1319831b06ddbc3f343ec2d8 /app/channel.go
parent8ec90d88faaf3ab57a6e7a0cdf46a376d6bed54b (diff)
downloadchat-be7c53ec7fffaa1751a162f4a34760f94e941bc6.tar.gz
chat-be7c53ec7fffaa1751a162f4a34760f94e941bc6.tar.bz2
chat-be7c53ec7fffaa1751a162f4a34760f94e941bc6.zip
Send status change event if status changes on channel view (#6389)
Diffstat (limited to 'app/channel.go')
-rw-r--r--app/channel.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/channel.go b/app/channel.go
index 3e794a0c9..a1a70560d 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -1016,9 +1016,13 @@ func GetNumberOfChannelsOnTeam(teamId string) (int, *model.AppError) {
func SetActiveChannel(userId string, channelId string) *model.AppError {
status, err := GetStatus(userId)
+
+ oldStatus := model.STATUS_OFFLINE
+
if err != nil {
status = &model.Status{UserId: userId, Status: model.STATUS_ONLINE, Manual: false, LastActivityAt: model.GetMillis(), ActiveChannel: channelId}
} else {
+ oldStatus = status.Status
status.ActiveChannel = channelId
if !status.Manual {
status.Status = model.STATUS_ONLINE
@@ -1028,6 +1032,10 @@ func SetActiveChannel(userId string, channelId string) *model.AppError {
AddStatusCache(status)
+ if status.Status != oldStatus {
+ BroadcastStatus(status)
+ }
+
return nil
}