summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-03-16 14:58:33 -0400
committerCorey Hulen <corey@hulen.com>2017-03-16 11:58:33 -0700
commitd757645c2490dd4f0de16cc32e05551b1476d0a0 (patch)
tree5d6e4049aa296b7629a34ca5b02d0aba25dd27dc /app/channel.go
parent04c0223c6402b12e67c61474ae310b0a56af6482 (diff)
downloadchat-d757645c2490dd4f0de16cc32e05551b1476d0a0.tar.gz
chat-d757645c2490dd4f0de16cc32e05551b1476d0a0.tar.bz2
chat-d757645c2490dd4f0de16cc32e05551b1476d0a0.zip
Implement some channel endpoints for APIv4 (#5767)
Diffstat (limited to 'app/channel.go')
-rw-r--r--app/channel.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/channel.go b/app/channel.go
index 49d55e52f..f63592000 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -702,6 +702,20 @@ func GetChannelCounts(teamId string, userId string) (*model.ChannelCounts, *mode
}
}
+func GetChannelUnread(channelId, userId string) (*model.ChannelUnread, *model.AppError) {
+ result := <-Srv.Store.Channel().GetChannelUnread(channelId, userId)
+ if result.Err != nil {
+ return nil, result.Err
+ }
+ channelUnread := result.Data.(*model.ChannelUnread)
+
+ if channelUnread.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_MARK_UNREAD_MENTION {
+ channelUnread.MsgCount = 0
+ }
+
+ return channelUnread, nil
+}
+
func JoinChannel(channel *model.Channel, userId string) *model.AppError {
if channel.DeleteAt > 0 {
return model.NewLocAppError("JoinChannel", "api.channel.join_channel.already_deleted.app_error", nil, "")