summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/channel.go')
-rw-r--r--app/channel.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/app/channel.go b/app/channel.go
index 7c63cbc6b..af7596ae1 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -313,7 +313,7 @@ func UpdateChannelMemberNotifyProps(data map[string]string, channelId string, us
func DeleteChannel(channel *model.Channel, userId string, siteURL string) *model.AppError {
uc := Srv.Store.User().Get(userId)
ihc := Srv.Store.Webhook().GetIncomingByChannel(channel.Id)
- ohc := Srv.Store.Webhook().GetOutgoingByChannel(channel.Id)
+ ohc := Srv.Store.Webhook().GetOutgoingByChannel(channel.Id, -1, -1)
if uresult := <-uc; uresult.Err != nil {
return uresult.Err
@@ -646,6 +646,14 @@ func GetChannelsUserNotIn(teamId string, userId string, offset int, limit int) (
}
}
+func GetPublicChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, *model.AppError) {
+ if result := <-Srv.Store.Channel().GetPublicChannelsForTeam(teamId, offset, limit); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.(*model.ChannelList), nil
+ }
+}
+
func GetChannelMember(channelId string, userId string) (*model.ChannelMember, *model.AppError) {
if result := <-Srv.Store.Channel().GetMember(channelId, userId); result.Err != nil {
return nil, result.Err
@@ -694,7 +702,25 @@ 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, siteURL string) *model.AppError {
+ if channel.DeleteAt > 0 {
+ return model.NewLocAppError("JoinChannel", "api.channel.join_channel.already_deleted.app_error", nil, "")
+ }
+
userChan := Srv.Store.User().Get(userId)
memberChan := Srv.Store.Channel().GetMember(channel.Id, userId)