Fixing autocomplete endpoint for in/out of channels (#12147)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
be0d13578d
Коммит
ecbc5ef5e1
21
api4/user.go
21
api4/user.go
@@ -806,6 +806,13 @@ func autocompleteUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var autocomplete model.UserAutocomplete
|
||||
|
||||
var err *model.AppError
|
||||
options, err = c.App.RestrictUsersSearchByPermissions(c.App.Session.UserId, options)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
if len(channelId) > 0 {
|
||||
// Applying the provided teamId here is useful for DMs and GMs which don't belong
|
||||
// to a team. Applying it when the channel does belong to a team makes less sense,
|
||||
@@ -819,13 +826,6 @@ func autocompleteUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
autocomplete.Users = result.InChannel
|
||||
autocomplete.OutOfChannel = result.OutOfChannel
|
||||
} else if len(teamId) > 0 {
|
||||
var err *model.AppError
|
||||
options, err = c.App.RestrictUsersSearchByPermissions(c.App.Session.UserId, options)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
result, err := c.App.AutocompleteUsersInTeam(teamId, name, options)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
@@ -834,13 +834,6 @@ func autocompleteUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
autocomplete.Users = result.InTeam
|
||||
} else {
|
||||
var err *model.AppError
|
||||
options, err = c.App.RestrictUsersSearchByPermissions(c.App.Session.UserId, options)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
result, err := c.App.SearchUsersInTeam("", name, options)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
|
||||
Ссылка в новой задаче
Block a user