settings_users: Fix the sorting of owner and admin in users list.

We were not considering the owner role in `sort_role` function
which was leading to improper sorting when sorting the users
list according to role. This commit fixes this bug by considering
role in `sort_role` function.
This commit is contained in:
sahil839 2021-05-05 18:08:04 +05:30 committed by Tim Abbott
parent f86ed57255
commit 357e3c7135
1 changed files with 8 additions and 5 deletions

View File

@ -57,16 +57,19 @@ function sort_bot_email(a, b) {
function sort_role(a, b) {
function role(user) {
if (user.is_admin) {
if (user.is_owner) {
return 0;
}
if (user.is_moderator) {
if (user.is_admin) {
return 1;
}
if (user.is_guest) {
return 3;
if (user.is_moderator) {
return 2;
}
return 2; // member
if (user.is_guest) {
return 4;
}
return 3; // member
}
return compare_a_b(role(a), role(b));
}