diff --git a/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala b/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala index 5769701..65cdd2d 100644 --- a/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala +++ b/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala @@ -333,15 +333,11 @@ val includeRemoved = params.get("includeRemoved").map(_.toBoolean).getOrElse(false) val includeGroups = params.get("includeGroups").map(_.toBoolean).getOrElse(false) val users = getAllUsers(includeRemoved, includeGroups) - if(includeGroups){ - val members = users.collect { case account if(account.isGroupAccount) => - account.userName -> getGroupMembers(account.userName).map(_.userName) - }.toMap + val members = users.collect { case account if(account.isGroupAccount) => + account.userName -> getGroupMembers(account.userName).map(_.userName) + }.toMap - html.userlist(users, members, includeRemoved, includeGroups) - }else{ - html.userlist(users, Map[String, List[String]](), includeRemoved, includeGroups) - } + html.userlist(users, members, includeRemoved, includeGroups) }) get("/admin/users/_newuser")(adminOnly { diff --git a/src/main/scala/gitbucket/core/service/AccountService.scala b/src/main/scala/gitbucket/core/service/AccountService.scala index e5bd0ce..e502236 100644 --- a/src/main/scala/gitbucket/core/service/AccountService.scala +++ b/src/main/scala/gitbucket/core/service/AccountService.scala @@ -98,16 +98,11 @@ def getAllUsers(includeRemoved: Boolean = true, includeGroups: Boolean = true)(implicit s: Session): List[Account] = { - ((includeRemoved, includeGroups) match { - case (true, true) => - Accounts - case (true, false) => - Accounts filter (_.groupAccount === false.bind) - case (false, true) => - Accounts filter (_.removed === false.bind) - case (false, false) => - Accounts filter (t => t.removed === false.bind && t.groupAccount === false.bind) - }) sortBy(_.userName) list + Accounts filter { t => + (1.bind === 1.bind) && + (t.groupAccount === false.bind, !includeGroups) && + (t.removed === false.bind, !includeRemoved) + } sortBy(_.userName) list } def isLastAdministrator(account: Account)(implicit s: Session): Boolean = {