[MM-25990] Add filters to search all channels (#15009)
* MM-25990 Add filters to search all channels endpoint and clean up tests * Add deleted filter * Remove redundant private public query
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
aad940e104
Коммит
ed34468996
@@ -999,12 +999,20 @@ func searchAllChannels(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
includeDeleted, _ := strconv.ParseBool(r.URL.Query().Get("include_deleted"))
|
||||
includeDeleted = includeDeleted || props.IncludeDeleted
|
||||
|
||||
opts := model.ChannelSearchOpts{
|
||||
NotAssociatedToGroup: props.NotAssociatedToGroup,
|
||||
ExcludeDefaultChannels: props.ExcludeDefaultChannels,
|
||||
IncludeDeleted: includeDeleted,
|
||||
Page: props.Page,
|
||||
PerPage: props.PerPage,
|
||||
NotAssociatedToGroup: props.NotAssociatedToGroup,
|
||||
ExcludeDefaultChannels: props.ExcludeDefaultChannels,
|
||||
TeamIds: props.TeamIds,
|
||||
GroupConstrained: props.GroupConstrained,
|
||||
ExcludeGroupConstrained: props.ExcludeGroupConstrained,
|
||||
Public: props.Public,
|
||||
Private: props.Private,
|
||||
IncludeDeleted: includeDeleted,
|
||||
Deleted: props.Deleted,
|
||||
Page: props.Page,
|
||||
PerPage: props.PerPage,
|
||||
}
|
||||
|
||||
channels, totalCount, appErr := c.App.SearchAllChannels(props.Term, opts)
|
||||
@@ -1014,9 +1022,7 @@ func searchAllChannels(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Don't fill in channels props, since unused by client and potentially expensive.
|
||||
|
||||
var payload []byte
|
||||
|
||||
if props.Page != nil && props.PerPage != nil {
|
||||
data := model.ChannelsWithCount{Channels: channels, TotalCount: totalCount}
|
||||
payload = data.ToJson()
|
||||
|
||||
Ссылка в новой задаче
Block a user