Skip to content
Snippets Groups Projects
Unverified Commit 60d77f17 authored by Cam Saul's avatar Cam Saul
Browse files

Sort the /admin/people list by last_name & first_name

parent 401170fc
No related branches found
No related tags found
No related merge requests found
......@@ -402,7 +402,15 @@ export default class PeopleListingApp extends Component {
let { modal, users, groups } = this.props;
let { error } = this.state;
users = _.values(users).sort((a, b) => b.date_joined - a.date_joined);
// sort the users list by last_name, ignore case or diacritical marks. If last names are the same then compare by
// first name
const compareNames = (a, b) =>
a.localeCompare(b, undefined, { sensitivty: "base" });
users = _.values(users).sort(
(a, b) =>
compareNames(a.last_name, b.last_name) ||
compareNames(a.first_name, b.first_name),
);
return (
<LoadingAndErrorWrapper loading={!users} error={error}>
......
......@@ -23,7 +23,9 @@
"Fetch a list of all active `Users` for the admin People page."
[]
(db/select [User :id :first_name :last_name :email :is_superuser :google_auth :ldap_auth :last_login]
:is_active true))
:is_active true
{:order-by [[:%lower.last_name :asc]
[:%lower.first_name :asc]]}))
(defn- reactivate-user! [existing-user first-name last-name]
(when-not (:is_active existing-user)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment