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.
Этот коммит содержится в:
коммит произвёл
Eli Yukelzon
родитель
3993cac4ed
Коммит
d1b1b319cf
@@ -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) {
|
||||
|
||||
Ссылка в новой задаче
Block a user