MM-25261: Add 'include_deleted' parameter to get all channels API req… (#14721)

* MM-25261: Add 'include_deleted' parameter to get all channels API request.

* MM-25261: Adds test for deleted channels.

* MM-25261: Switches to single liner.

* MM-25261: Adhere to beta config setting for viewing archived channels.

* MM-25261: Test fix.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Martin Kraft
2020-06-19 16:53:37 -04:00
коммит произвёл GitHub
родитель d391fd6231
Коммит 6158e91308
4 изменённых файлов: 49 добавлений и 1 удалений

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

@@ -2201,7 +2201,16 @@ func (c *Client4) RemoveTeamIcon(teamId string) (bool, *Response) {
// GetAllChannels get all the channels. Must be a system administrator.
func (c *Client4) GetAllChannels(page int, perPage int, etag string) (*ChannelListWithTeamData, *Response) {
query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
return c.getAllChannels(page, perPage, etag, false)
}
// GetAllChannelsIncludeDeleted get all the channels. Must be a system administrator.
func (c *Client4) GetAllChannelsIncludeDeleted(page int, perPage int, etag string) (*ChannelListWithTeamData, *Response) {
return c.getAllChannels(page, perPage, etag, true)
}
func (c *Client4) getAllChannels(page int, perPage int, etag string, includeDeleted bool) (*ChannelListWithTeamData, *Response) {
query := fmt.Sprintf("?page=%v&per_page=%v&include_deleted=%v", page, perPage, includeDeleted)
r, err := c.DoApiGet(c.GetChannelsRoute()+query, etag)
if err != nil {
return nil, BuildErrorResponse(r, err)