MM-18512 Use options struct for GetProfilesWithoutTeam and add filtering to API (#12200)
* Use options struct for GetProfilesWithoutTeam and add filtering * Fix test
Этот коммит содержится в:
коммит произвёл
Miguel de la Cruz
родитель
4ce7b92283
Коммит
3d4c941ba8
@@ -589,8 +589,8 @@ func (a *App) GetUsersNotInChannelPage(teamId string, channelId string, groupCon
|
||||
return a.sanitizeProfiles(users, asAdmin), nil
|
||||
}
|
||||
|
||||
func (a *App) GetUsersWithoutTeamPage(page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) {
|
||||
users, err := a.GetUsersWithoutTeam(page*perPage, perPage, viewRestrictions)
|
||||
func (a *App) GetUsersWithoutTeamPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError) {
|
||||
users, err := a.GetUsersWithoutTeam(options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -598,8 +598,8 @@ func (a *App) GetUsersWithoutTeamPage(page int, perPage int, asAdmin bool, viewR
|
||||
return a.sanitizeProfiles(users, asAdmin), nil
|
||||
}
|
||||
|
||||
func (a *App) GetUsersWithoutTeam(offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) {
|
||||
return a.Srv.Store.User().GetProfilesWithoutTeam(offset, limit, viewRestrictions)
|
||||
func (a *App) GetUsersWithoutTeam(options *model.UserGetOptions) ([]*model.User, *model.AppError) {
|
||||
return a.Srv.Store.User().GetProfilesWithoutTeam(options)
|
||||
}
|
||||
|
||||
// GetTeamGroupUsers returns the users who are associated to the team via GroupTeams and GroupMembers.
|
||||
|
||||
@@ -618,7 +618,7 @@ func TestResctrictedViewMembers(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
results, err := th.App.GetUsersWithoutTeam(0, 100, tc.Restrictions)
|
||||
results, err := th.App.GetUsersWithoutTeam(&model.UserGetOptions{Page: 0, PerPage: 100, ViewRestrictions: tc.Restrictions})
|
||||
require.Nil(t, err)
|
||||
ids := []string{}
|
||||
for _, result := range results {
|
||||
|
||||
Ссылка в новой задаче
Block a user