diff --git a/server/channels/app/channel.go b/server/channels/app/channel.go index d7dcce3ba0..3a763e7633 100644 --- a/server/channels/app/channel.go +++ b/server/channels/app/channel.go @@ -2720,7 +2720,7 @@ func (a *App) MarkChannelAsUnreadFromPost(c request.CTX, postID string, userID s return channelUnread, model.NewAppError("MarkChannelAsUnreadFromPost", "app.channel.update_last_viewed_at_post.app_error", nil, "", http.StatusInternalServerError).Wrap(nErr) } - a.sendWebSocketPostUnreadEvent(c, channelUnread, postID, false) + a.sendWebSocketPostUnreadEvent(c, channelUnread, postID) a.UpdateMobileAppBadge(userID) return channelUnread, nil @@ -2756,7 +2756,7 @@ func (a *App) markChannelAsUnreadFromPostCRTUnsupported(c request.CTX, postID st return channelUnread, model.NewAppError("MarkChannelAsUnreadFromPost", "app.channel.update_last_viewed_at_post.app_error", nil, "", http.StatusInternalServerError).Wrap(nErr) } - a.sendWebSocketPostUnreadEvent(c, channelUnread, postID, true) + a.sendWebSocketPostUnreadEvent(c, channelUnread, postID) a.UpdateMobileAppBadge(userID) return channelUnread, nil } @@ -2829,17 +2829,15 @@ func (a *App) markChannelAsUnreadFromPostCRTUnsupported(c request.CTX, postID st if nErr != nil { return channelUnread, model.NewAppError("MarkChannelAsUnreadFromPost", "app.channel.update_last_viewed_at_post.app_error", nil, "", http.StatusInternalServerError).Wrap(nErr) } - a.sendWebSocketPostUnreadEvent(c, channelUnread, postID, false) + a.sendWebSocketPostUnreadEvent(c, channelUnread, postID) a.UpdateMobileAppBadge(userID) return channelUnread, nil } -func (a *App) sendWebSocketPostUnreadEvent(c request.CTX, channelUnread *model.ChannelUnreadAt, postID string, withMsgCountRoot bool) { +func (a *App) sendWebSocketPostUnreadEvent(c request.CTX, channelUnread *model.ChannelUnreadAt, postID string) { message := model.NewWebSocketEvent(model.WebsocketEventPostUnread, channelUnread.TeamId, channelUnread.ChannelId, channelUnread.UserId, nil, "") message.Add("msg_count", channelUnread.MsgCount) - if withMsgCountRoot { - message.Add("msg_count_root", channelUnread.MsgCountRoot) - } + message.Add("msg_count_root", channelUnread.MsgCountRoot) message.Add("mention_count", channelUnread.MentionCount) message.Add("mention_count_root", channelUnread.MentionCountRoot) message.Add("urgent_mention_count", channelUnread.UrgentMentionCount)