diff options
author | JoramWilander <jwawilander@gmail.com> | 2017-05-12 08:00:28 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2017-05-12 08:00:28 -0400 |
commit | 9d109b070037951fcd0832b785eba8a3db9a157c (patch) | |
tree | 5d109da2e9e088f16eff0ad1421876a3d3da412e /app/channel.go | |
parent | b1c39204a63a87d2cbc57f66cf9db50c938b2ee5 (diff) | |
parent | a21a06afd9907e9911dcb166d902cba9f405c7cb (diff) | |
download | chat-9d109b070037951fcd0832b785eba8a3db9a157c.tar.gz chat-9d109b070037951fcd0832b785eba8a3db9a157c.tar.bz2 chat-9d109b070037951fcd0832b785eba8a3db9a157c.zip |
Merge branch 'release-3.9' into merge-3.9
Diffstat (limited to 'app/channel.go')
-rw-r--r-- | app/channel.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/channel.go b/app/channel.go index f39a57839..4164b37ce 100644 --- a/app/channel.go +++ b/app/channel.go @@ -218,7 +218,7 @@ func WaitForChannelMembership(channelId string, userId string) { } } -func CreateGroupChannel(userIds []string) (*model.Channel, *model.AppError) { +func CreateGroupChannel(userIds []string, creatorId string) (*model.Channel, *model.AppError) { if len(userIds) > model.CHANNEL_GROUP_MAX_USERS || len(userIds) < model.CHANNEL_GROUP_MIN_USERS { return nil, model.NewAppError("CreateGroupChannel", "api.channel.create_group.bad_size.app_error", nil, "", http.StatusBadRequest) } @@ -261,6 +261,10 @@ func CreateGroupChannel(userIds []string) (*model.Channel, *model.AppError) { return nil, result.Err } + if user.Id == creatorId { + WaitForChannelMembership(group.Id, creatorId) + } + InvalidateCacheForUser(user.Id) } @@ -1021,9 +1025,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 @@ -1033,6 +1041,10 @@ func SetActiveChannel(userId string, channelId string) *model.AppError { AddStatusCache(status) + if status.Status != oldStatus { + BroadcastStatus(status) + } + return nil } |