diff --git a/frontend/src/metabase/admin/people/containers/PeopleListingApp.jsx b/frontend/src/metabase/admin/people/containers/PeopleListingApp.jsx index a022aaca4e46d52e327ce2d86117c390489806ab..014842c6fb86ebfbd79df433e0f73a5570b965df 100644 --- a/frontend/src/metabase/admin/people/containers/PeopleListingApp.jsx +++ b/frontend/src/metabase/admin/people/containers/PeopleListingApp.jsx @@ -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}> diff --git a/src/metabase/api/user.clj b/src/metabase/api/user.clj index fdb7a6b7191c02fdf13da5a6bcf85fa60549c9c2..342e59eb7a586eb2c79620fc78daf83c00653b92 100644 --- a/src/metabase/api/user.clj +++ b/src/metabase/api/user.clj @@ -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)