MM-16499: Adds ability to retrieve channels with total count f… (#11375)

* MM-16499: Adds ability to retrieve channels with total count for pagination.

* MM-16499: Switches to custom package name for squirrel.
Этот коммит содержится в:
Martin Kraft
2019-06-25 08:18:48 -04:00
коммит произвёл Eli Yukelzon
родитель 3993cac4ed
Коммит d1b1b319cf
10 изменённых файлов: 175 добавлений и 25 удалений

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

@@ -534,7 +534,23 @@ func getAllChannels(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
w.Write([]byte(channels.ToJson()))
var payload []byte
if c.Params.IncludeTotalCount {
totalCount, err := c.App.GetAllChannelsCount(opts)
if err != nil {
c.Err = err
return
}
cwc := &model.ChannelsWithCount{
Channels: channels,
TotalCount: totalCount,
}
payload = cwc.ToJson()
} else {
payload = []byte(channels.ToJson())
}
w.Write(payload)
}
func getPublicChannelsForTeam(c *Context, w http.ResponseWriter, r *http.Request) {