MM-9274- Sort Users in Channel by status (#8181)

* sort by lastActivity

* added status ordering to Users

* sort offline before dnd

* remove data not needed

* added seperate call for when order=‘status’ is on GetUser request

* remove PrintLn

* styling fix

* remove mistake

* mistake 2

* better comment

* explicit if statemnt

* writing tests

* removed manually added mocks

* generated mock

* ICU-668 Added unit tests

* style fix

* sort by lastActivity

* added status ordering to Users

* sort offline before dnd

* remove data not needed

* added seperate call for when order=‘status’ is on GetUser request

* remove PrintLn

* styling fix

* remove mistake

* mistake 2

* better comment

* explicit if statemnt

* writing tests

* removed manually added mocks

* generated mock

* ICU-668 Added unit tests

* style fix

* reverse dnd and offline

* Fixed app.SaveStatusAndBroadcast

* Fixed incorrect merge

* Fixing incorrect merge again
Этот коммит содержится в:
Stephen Kiers
2018-03-09 05:48:30 -07:00
коммит произвёл Joram Wilander
родитель 31532f7feb
Коммит 302dae5bb9
14 изменённых файлов: 538 добавлений и 29 удалений

Просмотреть файл

@@ -695,7 +695,7 @@ func (c *Client4) GetUsersNotInTeam(teamId string, page int, perPage int, etag s
}
}
// GetUsersInChannel returns a page of users on a team. Page counting starts at 0.
// GetUsersInChannel returns a page of users in a channel. Page counting starts at 0.
func (c *Client4) GetUsersInChannel(channelId string, page int, perPage int, etag string) ([]*User, *Response) {
query := fmt.Sprintf("?in_channel=%v&page=%v&per_page=%v", channelId, page, perPage)
if r, err := c.DoApiGet(c.GetUsersRoute()+query, etag); err != nil {
@@ -706,7 +706,18 @@ func (c *Client4) GetUsersInChannel(channelId string, page int, perPage int, eta
}
}
// GetUsersNotInChannel returns a page of users on a team. Page counting starts at 0.
// GetUsersInChannelStatus 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 {
return nil, BuildErrorResponse(r, err)
} else {
defer closeBody(r)
return UserListFromJson(r.Body), BuildResponse(r)
}
}
// GetUsersNotInChannel returns a page of users not in a channel. Page counting starts at 0.
func (c *Client4) GetUsersNotInChannel(teamId, channelId string, page int, perPage int, etag string) ([]*User, *Response) {
query := fmt.Sprintf("?in_team=%v&not_in_channel=%v&page=%v&per_page=%v", teamId, channelId, page, perPage)
if r, err := c.DoApiGet(c.GetUsersRoute()+query, etag); err != nil {