[MM-13500] Adds channel /search_group endpoint (#10805)
* [MM-13500] Adds channel /search_group endpoint * Add LIMIT to the queries * Fix i18n extract * Fix tests * Add a new endpoint to get profiles by group channel ids * Rebase fix
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
604e247135
Коммит
9e9b008f3d
@@ -18,6 +18,7 @@ func (api *API) InitChannel() {
|
||||
api.BaseRoutes.Channels.Handle("", api.ApiSessionRequired(createChannel)).Methods("POST")
|
||||
api.BaseRoutes.Channels.Handle("/direct", api.ApiSessionRequired(createDirectChannel)).Methods("POST")
|
||||
api.BaseRoutes.Channels.Handle("/search", api.ApiSessionRequired(searchAllChannels)).Methods("POST")
|
||||
api.BaseRoutes.Channels.Handle("/group/search", api.ApiSessionRequired(searchGroupChannels)).Methods("POST")
|
||||
api.BaseRoutes.Channels.Handle("/group", api.ApiSessionRequired(createGroupChannel)).Methods("POST")
|
||||
api.BaseRoutes.Channels.Handle("/members/{user_id:[A-Za-z0-9]+}/view", api.ApiSessionRequired(viewChannel)).Methods("POST")
|
||||
api.BaseRoutes.Channels.Handle("/{channel_id:[A-Za-z0-9]+}/scheme", api.ApiSessionRequired(updateChannelScheme)).Methods("PUT")
|
||||
@@ -356,6 +357,22 @@ func createDirectChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(sc.ToJson()))
|
||||
}
|
||||
|
||||
func searchGroupChannels(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
props := model.ChannelSearchFromJson(r.Body)
|
||||
if props == nil {
|
||||
c.SetInvalidParam("channel_search")
|
||||
return
|
||||
}
|
||||
|
||||
groupChannels, err := c.App.SearchGroupChannels(c.App.Session.UserId, props.Term)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
w.Write([]byte(groupChannels.ToJson()))
|
||||
}
|
||||
|
||||
func createGroupChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
userIds := model.ArrayFromJson(r.Body)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user