Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVE] Sort Users List In Case Insensitive Manner #20790

Merged
merged 12 commits into from
Mar 22, 2021

Conversation

aditya-mitra
Copy link
Contributor

@aditya-mitra aditya-mitra commented Feb 17, 2021

Proposed changes (including videos or screenshots)

The users listed in the admin panel were sorted in a case-sensitive manner , where the capitals came first and then the small letters (like - A B C a b c). This Change fixes this by sorting the names in a caseinsensitive manner (now - A a B b C c).

Before

before

With This Change

after

Issue(s)

Closes #14735

Steps to test or reproduce

  1. Go to Administration
  2. Select the Users Tab
  3. Users Names are sorted in case-sensitive manner ( like A B C a b c )

Further comments

user.list.sorting.in.case.insensitive.manner.mp4

app/api/server/lib/users.js Show resolved Hide resolved
app/api/server/v1/users.js Outdated Show resolved Hide resolved
@KevLehman
Copy link
Contributor

I know this is Out of scope for this ticket, but, is this also happening with Room names? If so, we'd need to create an issue for that.

@aditya-mitra
Copy link
Contributor Author

I know this is Out of scope for this ticket, but, is this also happening with Room names? If so, we'd need to create an issue for that.

I will check that for sure!
Can you please help to determine why the tests are failing?

@KevLehman
Copy link
Contributor

It looks like the payload is not including all expected keys:
image

As you see, only _id and ..insensitive are being returned. This may be because the $project doesn't support selecting and adding new fields in the same stage. I'd recommend adding an $addFields stage just to add the nameInsensitive field, and let the projection alone.

Since username is not being returned in the user payload, this line is crashing:
image

@aditya-mitra aditya-mitra force-pushed the aditya-mitra-sort-users-admin branch 5 times, most recently from 58df41d to ca38192 Compare February 19, 2021 04:02
app/api/server/lib/users.js Show resolved Hide resolved
app/api/server/lib/users.js Outdated Show resolved Hide resolved
@aditya-mitra aditya-mitra force-pushed the aditya-mitra-sort-users-admin branch from aaaf682 to f117322 Compare February 19, 2021 13:33
@ggazzo ggazzo added this to the 3.12.0 milestone Feb 19, 2021
@ggazzo ggazzo merged commit 5392f09 into RocketChat:develop Mar 22, 2021
@sampaiodiego sampaiodiego mentioned this pull request Apr 3, 2021
13 tasks
@aditya-mitra aditya-mitra deleted the aditya-mitra-sort-users-admin branch July 21, 2021 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Users list sorting is case sensitive
3 participants