summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorJason Simmons <1382389+jasimmons@users.noreply.github.com>2018-10-22 08:49:50 -0400
committerJoram Wilander <jwawilander@gmail.com>2018-10-22 08:49:50 -0400
commit1ee872578c734956acc7f5e4168638de244c3ce2 (patch)
treef0cf22a79c7b1b903ce5093479ee2cda509e7805 /model
parent6c6638f05e99f1463ff33983540aedb35271dbfc (diff)
downloadchat-1ee872578c734956acc7f5e4168638de244c3ce2.tar.gz
chat-1ee872578c734956acc7f5e4168638de244c3ce2.tar.bz2
chat-1ee872578c734956acc7f5e4168638de244c3ce2.zip
GH-9636 plugins api GetUsersInChannelByStatus (#9645)
* adds GetUsersInChannelByStatus to plugin api with generated rpc code. * fixed typo in comment with actual func name * replaced Response model with AppError in output of GetUsersInChannelByStatus * removed etag param from GetUsersInChannelByStatus since it is not used * plugin api for GetUsersInChannelByStatus updated to take the limit, conforming to the app api. * fixed an issue in my own logic on app/plugin integration. * adds GetUsersInChannelByStatus to plugin api with generated rpc code. * fixed typo in comment with actual func name * replaced Response model with AppError in output of GetUsersInChannelByStatus * removed etag param from GetUsersInChannelByStatus since it is not used * plugin api for GetUsersInChannelByStatus updated to take the limit, conforming to the app api. * fixed an issue in my own logic on app/plugin integration. * GetUsersInChannelByStatus changed to more generic GetUsersInChannel which takes a sortBy parameter, allowing for more granular/extensible sorting functionality in the future * GetUsersInChannel accepts sort parameter of 'username' and 'status'. Both values are consts in model pkg. * Documents minimum server version for GetUsersInChannel. * adds GetUsersInChannelByStatus to plugin api with generated rpc code. * fixed typo in comment with actual func name * replaced Response model with AppError in output of GetUsersInChannelByStatus * removed etag param from GetUsersInChannelByStatus since it is not used * plugin api for GetUsersInChannelByStatus updated to take the limit, conforming to the app api. * fixed an issue in my own logic on app/plugin integration. * adds GetUsersInChannelByStatus to plugin api with generated rpc code. * Resolved conflict on rebase * replaced Response model with AppError in output of GetUsersInChannelByStatus * removed etag param from GetUsersInChannelByStatus since it is not used * plugin api for GetUsersInChannelByStatus updated to take the limit, conforming to the app api. * fixed an issue in my own logic on app/plugin integration. * GetUsersInChannelByStatus changed to more generic GetUsersInChannel which takes a sortBy parameter, allowing for more granular/extensible sorting functionality in the future * GetUsersInChannel accepts sort parameter of 'username' and 'status'. Both values are consts in model pkg. * Documents minimum server version for GetUsersInChannel. * replaces GetUsersInChannel from #9608 / #9643 with sortBy functionality
Diffstat (limited to 'model')
-rw-r--r--model/channel.go3
-rw-r--r--model/client4.go2
2 files changed, 4 insertions, 1 deletions
diff --git a/model/channel.go b/model/channel.go
index 529c49d35..f8867babb 100644
--- a/model/channel.go
+++ b/model/channel.go
@@ -29,6 +29,9 @@ const (
CHANNEL_HEADER_MAX_RUNES = 1024
CHANNEL_PURPOSE_MAX_RUNES = 250
CHANNEL_CACHE_SIZE = 25000
+
+ CHANNEL_SORT_BY_USERNAME = "username"
+ CHANNEL_SORT_BY_STATUS = "status"
)
type Channel struct {
diff --git a/model/client4.go b/model/client4.go
index a9b4d3826..cce3b62ef 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -832,7 +832,7 @@ func (c *Client4) GetUsersInChannel(channelId string, page int, perPage int, eta
}
}
-// GetUsersInChannelStatus returns a page of users in a channel. Page counting starts at 0. Sorted by Status
+// GetUsersInChannelByStatus returns a page of users in a channel. Page counting starts at 0. Sorted by Status
func (c *Client4) GetUsersInChannelByStatus(channelId string, page int, perPage int, etag string) ([]*User, *Response) {
query := fmt.Sprintf("?in_channel=%v&page=%v&per_page=%v&sort=status", channelId, page, perPage)
if r, err := c.DoApiGet(c.GetUsersRoute()+query, etag); err != nil {