Add parameter to return group members in order of display name (#21775)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
fae9bdf173
Коммит
33b59e0e96
23
api4/user.go
23
api4/user.go
@@ -662,13 +662,14 @@ func getUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if sort != "" && sort != "last_activity_at" && sort != "create_at" && sort != "status" && sort != "admin" {
|
||||
if sort != "" && sort != "last_activity_at" && sort != "create_at" && sort != "status" && sort != "admin" && sort != "display_name" {
|
||||
c.SetInvalidURLParam("sort")
|
||||
return
|
||||
}
|
||||
|
||||
// Currently only supports sorting on a team
|
||||
// or sort="status" on inChannelId
|
||||
// or sort="display_name" on inGroupId
|
||||
if (sort == "last_activity_at" || sort == "create_at") && (inTeamId == "" || notInTeamId != "" || inChannelId != "" || notInChannelId != "" || withoutTeam != "" || inGroupId != "" || notInGroupId != "") {
|
||||
c.SetInvalidURLParam("sort")
|
||||
return
|
||||
@@ -681,6 +682,10 @@ func getUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.SetInvalidURLParam("sort")
|
||||
return
|
||||
}
|
||||
if sort == "display_name" && (inGroupId == "" || notInGroupId != "" || inTeamId != "" || notInTeamId != "" || inChannelId != "" || notInChannelId != "" || withoutTeam != "") {
|
||||
c.SetInvalidURLParam("sort")
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
withoutTeamBool, _ = strconv.ParseBool(withoutTeam)
|
||||
@@ -869,10 +874,18 @@ func getUsers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
profiles, _, appErr = c.App.GetGroupMemberUsersPage(inGroupId, c.Params.Page, c.Params.PerPage, userGetOptions.ViewRestrictions)
|
||||
if appErr != nil {
|
||||
c.Err = appErr
|
||||
return
|
||||
if sort == "display_name" {
|
||||
var user *model.User
|
||||
|
||||
user, appErr = c.App.GetUser(c.AppContext.Session().UserId)
|
||||
if appErr != nil {
|
||||
c.Err = appErr
|
||||
return
|
||||
}
|
||||
|
||||
profiles, _, appErr = c.App.GetGroupMemberUsersSortedPage(inGroupId, c.Params.Page, c.Params.PerPage, userGetOptions.ViewRestrictions, c.App.GetNotificationNameFormat(user))
|
||||
} else {
|
||||
profiles, _, appErr = c.App.GetGroupMemberUsersPage(inGroupId, c.Params.Page, c.Params.PerPage, userGetOptions.ViewRestrictions)
|
||||
}
|
||||
} else if notInGroupId != "" {
|
||||
appErr = requireGroupAccess(c, notInGroupId)
|
||||
|
||||
Ссылка в новой задаче
Block a user