[MM-21517] Team Member Manage User Modal not display correct roles (#14043)
* join on the users table and order by username * don't inclue users who have been deleted * Address PR comments * update tests * fix linting * fix linting * include ExcludeDeletedUsers flag * fix gofmt * fix nil teamMembersGetOptions * fix gofmt error * Add Unit Tests * fix gofmt bugs * partially address comments * fix incorrect import * Address Comments and fix golint errors * store mocks * address PR comments about tests and styling * Update model/team_member.go Co-Authored-By: Jesse Hallam <jesse.hallam@gmail.com> * Address PR comments * update client function name Co-authored-by: mattermod <mattermod@users.noreply.github.com> Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7ce68e89d7
Коммит
bd2c1f4522
@@ -847,15 +847,32 @@ func (s SqlTeamStore) GetMember(teamId string, userId string) (*model.TeamMember
|
||||
return dbMember.ToModel(), nil
|
||||
}
|
||||
|
||||
func (s SqlTeamStore) GetMembers(teamId string, offset int, limit int, restrictions *model.ViewUsersRestrictions) ([]*model.TeamMember, *model.AppError) {
|
||||
func (s SqlTeamStore) GetMembers(teamId string, offset int, limit int, teamMembersGetOptions *model.TeamMembersGetOptions) ([]*model.TeamMember, *model.AppError) {
|
||||
query := s.getTeamMembersWithSchemeSelectQuery().
|
||||
Where(sq.Eq{"TeamMembers.TeamId": teamId}).
|
||||
Where(sq.Eq{"TeamMembers.DeleteAt": 0}).
|
||||
OrderBy("UserId").
|
||||
Limit(uint64(limit)).
|
||||
Offset(uint64(offset))
|
||||
|
||||
query = applyTeamMemberViewRestrictionsFilter(query, teamId, restrictions)
|
||||
if teamMembersGetOptions == nil || teamMembersGetOptions.Sort == "" {
|
||||
query = query.OrderBy("UserId")
|
||||
}
|
||||
|
||||
if teamMembersGetOptions != nil {
|
||||
if teamMembersGetOptions.Sort == model.USERNAME || teamMembersGetOptions.ExcludeDeletedUsers {
|
||||
query = query.LeftJoin("Users ON TeamMembers.UserId = Users.Id")
|
||||
}
|
||||
|
||||
if teamMembersGetOptions.ExcludeDeletedUsers {
|
||||
query = query.Where(sq.Eq{"Users.DeleteAt": 0})
|
||||
}
|
||||
|
||||
if teamMembersGetOptions.Sort == model.USERNAME {
|
||||
query = query.OrderBy(model.USERNAME)
|
||||
}
|
||||
|
||||
query = applyTeamMemberViewRestrictionsFilter(query, teamId, teamMembersGetOptions.ViewRestrictions)
|
||||
}
|
||||
|
||||
queryString, args, err := query.ToSql()
|
||||
if err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user