Admin area - sorting groups by name works unexpectedly
### Summary In the admin area, when looking at the list of groups, if the "Name" sort is chosen, the groups do not SEEM to be sorted by name. It took a lot of head-scratching to figure out what's going on. They actually are sorted by name, but it's the last name in the hierarchy, rather than the first name. So here's a contrived example of a group order that this would produce: ``` dev / api beeps git zip / jump test apple / view ``` When viewing groups outside of the admin area, sorting them by name puts them in what I consider to be a logical order. In that view the hierarchy is more obvious, because the top level must be expanded to see the children. I think this was working as expected in version 9.1.2. Today I upgraded to 9.5.10 and then 10.8.4, using the yum repository. ### Steps to reproduce Click the wrench to get to the admin area, click groups on the left. In the sort dropdown next to "New group", choose "Name". Choosing "Name, descending" shows the same order in reverse. #### Results of GitLab environment info ``` System information System: Current User: git Using RVM: no Ruby Version: 2.3.7p456 Gem Version: 2.6.14 Bundler Version:1.13.7 Rake Version: 12.3.1 Redis Version: 3.2.11 Git Version: 2.16.4 Sidekiq Version:5.0.5 Go Version: unknown GitLab information Version: 10.8.4 Revision: 2268d0c Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://gitlab.mainstreamdata.com HTTP Clone URL: https://gitlab.mainstreamdata.com/some-group/some-project.git SSH Clone URL: git@gitlab.mainstreamdata.com:some-group/some-project.git Using LDAP: no Using Omniauth: no GitLab Shell Version: 7.1.2 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git ``` #### Results of GitLab application Check ``` Checking GitLab Shell ... GitLab Shell version >= 7.1.2 ? ... OK (7.1.2) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 4/2 ... ok 7/4 ... ok 8/5 ... ok 12/6 ... ok 8/7 ... ok 14/8 ... ok 16/9 ... ok 15/10 ... ok 14/11 ... ok 15/12 ... ok 15/13 ... ok 15/14 ... ok 23/15 ... ok 15/16 ... ok 15/17 ... ok 20/18 ... ok 20/19 ... ok 16/20 ... ok 16/21 ... ok 22/23 ... ok 16/24 ... ok 25/25 ... ok 25/26 ... ok 26/27 ... ok 6/28 ... ok 27/29 ... ok 26/30 ... ok 26/31 ... ok 28/32 ... ok 26/33 ... ok 14/34 ... ok 31/35 ... ok 32/36 ... ok 35/37 ... ok 36/39 ... ok 28/41 ... ok 38/43 ... ok 38/45 ... ok 38/46 ... ok 40/47 ... ok 40/48 ... ok 40/49 ... ok 39/50 ... ok 14/51 ... ok 26/52 ... ok 23/53 ... ok 14/54 ... ok 14/55 ... ok 14/56 ... repository is empty 14/57 ... ok 8/58 ... ok 26/59 ... ok 41/60 ... ok 41/61 ... ok 26/62 ... ok 41/63 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Sidekiq ... Running? ... yes Number of Sidekiq processes ... 1 Checking Sidekiq ... Finished Reply by email is disabled in config/gitlab.yml Checking LDAP ... LDAP is disabled in config/gitlab.yml Checking LDAP ... Finished Checking GitLab ... Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 4/2 ... yes 7/4 ... yes 8/5 ... yes 12/6 ... yes 8/7 ... yes 14/8 ... yes 16/9 ... yes 15/10 ... yes 14/11 ... yes 15/12 ... yes 15/13 ... yes 15/14 ... yes 23/15 ... yes 15/16 ... yes 15/17 ... yes 20/18 ... yes 20/19 ... yes 16/20 ... yes 16/21 ... yes 22/23 ... yes 16/24 ... yes 25/25 ... yes 25/26 ... yes 26/27 ... yes 6/28 ... yes 27/29 ... yes 26/30 ... yes 26/31 ... yes 28/32 ... yes 26/33 ... yes 14/34 ... yes 31/35 ... yes 32/36 ... yes 35/37 ... yes 36/39 ... yes 28/41 ... yes 38/43 ... yes 38/45 ... yes 38/46 ... yes 40/47 ... yes 40/48 ... yes 40/49 ... yes 39/50 ... yes 14/51 ... yes 26/52 ... yes 23/53 ... yes 14/54 ... yes 14/55 ... yes 14/56 ... yes 14/57 ... yes 8/58 ... yes 26/59 ... yes 41/60 ... yes 41/61 ... yes 26/62 ... yes 41/63 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.7) Git version >= 2.9.5 ? ... yes (2.16.4) Git user has default SSH configuration? ... yes Active users: ... 14 Checking GitLab ... Finished ```
issue