diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2016-01-06 18:04:24 -0500 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2016-01-06 18:04:24 -0500 |
commit | 0e7a149982f73919badd9d366d06fa699925c89f (patch) | |
tree | b8609b4ce5a962a3db80a790d4dcb1f48bf717c3 /store | |
parent | 5855b5e4590889944e4a408f7185f84779fc701a (diff) | |
download | chat-0e7a149982f73919badd9d366d06fa699925c89f.tar.gz chat-0e7a149982f73919badd9d366d06fa699925c89f.tar.bz2 chat-0e7a149982f73919badd9d366d06fa699925c89f.zip |
Added the ability to get more channel members from getChannelExtraInfo
Diffstat (limited to 'store')
-rw-r--r-- | store/sql_channel_store.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index c9e0d113f..4585647de 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -603,7 +603,14 @@ func (s SqlChannelStore) GetExtraMembers(channelId string, limit int) StoreChann result := StoreResult{} var members []model.ExtraMember - _, err := s.GetReplica().Select(&members, "SELECT Id, Nickname, Email, ChannelMembers.Roles, Username FROM ChannelMembers, Users WHERE ChannelMembers.UserId = Users.Id AND ChannelId = :ChannelId LIMIT :Limit", map[string]interface{}{"ChannelId": channelId, "Limit": limit}) + var err error + + if limit != -1 { + _, err = s.GetReplica().Select(&members, "SELECT Id, Nickname, Email, ChannelMembers.Roles, Username FROM ChannelMembers, Users WHERE ChannelMembers.UserId = Users.Id AND ChannelId = :ChannelId LIMIT :Limit", map[string]interface{}{"ChannelId": channelId, "Limit": limit}) + } else { + _, err = s.GetReplica().Select(&members, "SELECT Id, Nickname, Email, ChannelMembers.Roles, Username FROM ChannelMembers, Users WHERE ChannelMembers.UserId = Users.Id AND ChannelId = :ChannelId", map[string]interface{}{"ChannelId": channelId}) + } + if err != nil { result.Err = model.NewAppError("SqlChannelStore.GetExtraMembers", "We couldn't get the extra info for channel members", "channel_id="+channelId+", "+err.Error()) } else { |