summaryrefslogtreecommitdiffstats
path: root/store/sql_channel_store.go
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-11-10 11:23:55 -0300
committerHarrison Healey <harrisonmhealey@gmail.com>2016-11-10 09:23:55 -0500
commitbe17e05d7322f9c6e6cbf93bff1cfca63b73aa76 (patch)
treec877856f934ba2f732548a6dbc2f8a0afb95f7a1 /store/sql_channel_store.go
parent8c76560b4849f8d1fdc3c3f1c2f1877459a30fca (diff)
downloadchat-be17e05d7322f9c6e6cbf93bff1cfca63b73aa76.tar.gz
chat-be17e05d7322f9c6e6cbf93bff1cfca63b73aa76.tar.bz2
chat-be17e05d7322f9c6e6cbf93bff1cfca63b73aa76.zip
PLT-4665 Fix Max Channels limit wrong count (#4512)
Diffstat (limited to 'store/sql_channel_store.go')
-rw-r--r--store/sql_channel_store.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go
index 5107a0bd8..aadeed7c3 100644
--- a/store/sql_channel_store.go
+++ b/store/sql_channel_store.go
@@ -464,6 +464,32 @@ func (s SqlChannelStore) GetChannelCounts(teamId string, userId string) StoreCha
return storeChannel
}
+func (s SqlChannelStore) GetTeamChannels(teamId string) StoreChannel {
+ storeChannel := make(StoreChannel, 1)
+
+ go func() {
+ result := StoreResult{}
+
+ data := &model.ChannelList{}
+ _, err := s.GetReplica().Select(data, "SELECT * FROM Channels WHERE TeamId = :TeamId And Type != 'D' ORDER BY DisplayName", map[string]interface{}{"TeamId": teamId})
+
+ if err != nil {
+ result.Err = model.NewLocAppError("SqlChannelStore.GetChannels", "store.sql_channel.get_channels.get.app_error", nil, "teamId="+teamId+", err="+err.Error())
+ } else {
+ if len(*data) == 0 {
+ result.Err = model.NewLocAppError("SqlChannelStore.GetChannels", "store.sql_channel.get_channels.not_found.app_error", nil, "teamId="+teamId)
+ } else {
+ result.Data = data
+ }
+ }
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}
+
func (s SqlChannelStore) GetByName(teamId string, name string) StoreChannel {
storeChannel := make(StoreChannel, 1)