diff options
Diffstat (limited to 'store/sql_channel_store.go')
-rw-r--r-- | store/sql_channel_store.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index 7c4e97bc0..dfc77bd8a 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -751,18 +751,18 @@ func (s SqlChannelStore) UpdateMember(member *model.ChannelMember) StoreChannel return storeChannel } -func (s SqlChannelStore) GetMembers(channelId string) StoreChannel { +func (s SqlChannelStore) GetMembers(channelId string, offset, limit int) StoreChannel { storeChannel := make(StoreChannel, 1) go func() { result := StoreResult{} - var members []model.ChannelMember - _, err := s.GetReplica().Select(&members, "SELECT * FROM ChannelMembers WHERE ChannelId = :ChannelId", map[string]interface{}{"ChannelId": channelId}) + var members model.ChannelMembers + _, err := s.GetReplica().Select(&members, "SELECT * FROM ChannelMembers WHERE ChannelId = :ChannelId LIMIT :Limit OFFSET :Offset", map[string]interface{}{"ChannelId": channelId, "Limit": limit, "Offset": offset}) if err != nil { result.Err = model.NewLocAppError("SqlChannelStore.GetMembers", "store.sql_channel.get_members.app_error", nil, "channel_id="+channelId+err.Error()) } else { - result.Data = members + result.Data = &members } storeChannel <- result @@ -782,7 +782,7 @@ func (s SqlChannelStore) GetMember(channelId string, userId string) StoreChannel if err := s.GetReplica().SelectOne(&member, "SELECT * FROM ChannelMembers WHERE ChannelId = :ChannelId AND UserId = :UserId", map[string]interface{}{"ChannelId": channelId, "UserId": userId}); err != nil { if err == sql.ErrNoRows { - result.Err = model.NewLocAppError("SqlChannelStore.GetMember", MISSING_CHANNEL_MEMBER_ERROR, nil, "channel_id="+channelId+"user_id="+userId+","+err.Error()) + result.Err = model.NewAppError("SqlChannelStore.GetMember", MISSING_CHANNEL_MEMBER_ERROR, nil, "channel_id="+channelId+"user_id="+userId+","+err.Error(), http.StatusNotFound) } else { result.Err = model.NewLocAppError("SqlChannelStore.GetMember", "store.sql_channel.get_member.app_error", nil, "channel_id="+channelId+"user_id="+userId+","+err.Error()) } |