MM-24037 Adding getKnowUsers API endpoint (#14332)
* Adding getKnowUsers API endpoint * Adding i18n strings * Fixing golint errors * Adding doc strings * Remove debug line * Updating app_iface * Fixing gofmt
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d3b36e3455
Коммит
224b72c61e
13
api4/user.go
13
api4/user.go
@@ -26,6 +26,7 @@ func (api *API) InitUser() {
|
||||
api.BaseRoutes.Users.Handle("", api.ApiSessionRequired(getUsers)).Methods("GET")
|
||||
api.BaseRoutes.Users.Handle("/ids", api.ApiSessionRequired(getUsersByIds)).Methods("POST")
|
||||
api.BaseRoutes.Users.Handle("/usernames", api.ApiSessionRequired(getUsersByNames)).Methods("POST")
|
||||
api.BaseRoutes.Users.Handle("/known", api.ApiSessionRequired(getKnownUsers)).Methods("GET")
|
||||
api.BaseRoutes.Users.Handle("/search", api.ApiSessionRequiredDisableWhenBusy(searchUsers)).Methods("POST")
|
||||
api.BaseRoutes.Users.Handle("/autocomplete", api.ApiSessionRequired(autocompleteUsers)).Methods("GET")
|
||||
api.BaseRoutes.Users.Handle("/stats", api.ApiSessionRequired(getTotalUsersStats)).Methods("GET")
|
||||
@@ -717,6 +718,18 @@ func getUsersByNames(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(model.UserListToJson(users)))
|
||||
}
|
||||
|
||||
func getKnownUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
userIds, err := c.App.GetKnownUsers(c.App.Session().UserId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
data, _ := json.Marshal(userIds)
|
||||
|
||||
w.Write(data)
|
||||
}
|
||||
|
||||
func searchUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
props := model.UserSearchFromJson(r.Body)
|
||||
if props == nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user