[MM-44159] Add user sort by admin status in channels (#20562)

This commit is contained in:
Julien Tant
2022-06-30 09:20:14 -07:00
committed by GitHub
parent 91877c3016
commit b45ff0be5d
11 changed files with 260 additions and 1 deletions
+7 -1
View File
@@ -652,7 +652,7 @@ func getUsers(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if sort != "" && sort != "last_activity_at" && sort != "create_at" && sort != "status" {
if sort != "" && sort != "last_activity_at" && sort != "create_at" && sort != "status" && sort != "admin" {
c.SetInvalidURLParam("sort")
return
}
@@ -667,6 +667,10 @@ func getUsers(c *Context, w http.ResponseWriter, r *http.Request) {
c.SetInvalidURLParam("sort")
return
}
if sort == "admin" && inChannelId == "" {
c.SetInvalidURLParam("sort")
return
}
withoutTeamBool, _ := strconv.ParseBool(withoutTeam)
groupConstrainedBool, _ := strconv.ParseBool(groupConstrained)
@@ -799,6 +803,8 @@ func getUsers(c *Context, w http.ResponseWriter, r *http.Request) {
if sort == "status" {
profiles, err = c.App.GetUsersInChannelPageByStatus(userGetOptions, c.IsSystemAdmin())
} else if sort == "admin" {
profiles, err = c.App.GetUsersInChannelPageByAdmin(userGetOptions, c.IsSystemAdmin())
} else {
profiles, err = c.App.GetUsersInChannelPage(userGetOptions, c.IsSystemAdmin())
}