MM-25263 Add group members to search and get users and create getGroupStats endpoint (#14733)
Add tests for SearchInGroup
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f6c934d7e0
Коммит
77bee1d4f1
17
app/user.go
17
app/user.go
@@ -1693,6 +1693,9 @@ func (a *App) SearchUsers(props *model.UserSearch, options *model.UserSearchOpti
|
||||
if props.NotInTeamId != "" {
|
||||
return a.SearchUsersNotInTeam(props.NotInTeamId, props.Term, options)
|
||||
}
|
||||
if props.InGroupId != "" {
|
||||
return a.SearchUsersInGroup(props.InGroupId, props.Term, options)
|
||||
}
|
||||
return a.SearchUsersInTeam(props.TeamId, props.Term, options)
|
||||
}
|
||||
|
||||
@@ -1768,6 +1771,20 @@ func (a *App) SearchUsersWithoutTeam(term string, options *model.UserSearchOptio
|
||||
return users, nil
|
||||
}
|
||||
|
||||
func (a *App) SearchUsersInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) {
|
||||
term = strings.TrimSpace(term)
|
||||
users, err := a.Srv().Store.User().SearchInGroup(groupID, term, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, user := range users {
|
||||
a.SanitizeProfile(user, options.IsAdmin)
|
||||
}
|
||||
|
||||
return users, nil
|
||||
}
|
||||
|
||||
func (a *App) AutocompleteUsersInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError) {
|
||||
term = strings.TrimSpace(term)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user