diff options
Diffstat (limited to 'app/channel.go')
-rw-r--r-- | app/channel.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/app/channel.go b/app/channel.go index fcd4e166d..194a43f69 100644 --- a/app/channel.go +++ b/app/channel.go @@ -844,7 +844,15 @@ func SearchChannelsUserNotIn(teamId string, userId string, term string) (*model. } func ViewChannel(view *model.ChannelView, teamId string, userId string, clearPushNotifications bool) *model.AppError { - channelIds := []string{view.ChannelId} + if err := SetActiveChannel(userId, view.ChannelId); err != nil { + return err + } + + channelIds := []string{} + + if len(view.ChannelId) > 0 { + channelIds = append(channelIds, view.ChannelId) + } var pchan store.StoreChannel if len(view.PrevChannelId) > 0 { @@ -855,6 +863,10 @@ func ViewChannel(view *model.ChannelView, teamId string, userId string, clearPus } } + if len(channelIds) == 0 { + return nil + } + uchan := Srv.Store.Channel().UpdateLastViewedAt(channelIds, userId) if pchan != nil { @@ -871,10 +883,6 @@ func ViewChannel(view *model.ChannelView, teamId string, userId string, clearPus return result.Err } - message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_VIEWED, teamId, "", userId, nil) - message.Add("channel_id", view.ChannelId) - go Publish(message) - return nil } |