mirror of https://github.com/zulip/zulip.git
admin user: Sort bot owners by name.
The original commit here was sorting bot owners by
id, which is of course meaningless to users:
444ce74a8e
It was also returning 1/-1 in cases where the bot
owner on both sides of a comparison were missing,
which is a big no-no for sorting algorithms.
This commit is contained in:
parent
0b71b092b3
commit
aa5ffcbd2e
|
@ -39,10 +39,24 @@ function sort_role(a, b) {
|
|||
}
|
||||
|
||||
function sort_bot_owner(a, b) {
|
||||
if (!a.bot_owner_id) { return 1; }
|
||||
if (!b.bot_owner_id) { return -1; }
|
||||
function owner_name(item) {
|
||||
const owner = people.get_bot_owner_user(item);
|
||||
|
||||
return compare_a_b(a.bot_owner_id, b.bot_owner_id);
|
||||
if (!owner) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!owner.full_name) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return owner.full_name.toLowerCase();
|
||||
}
|
||||
|
||||
return compare_a_b(
|
||||
owner_name(a),
|
||||
owner_name(b)
|
||||
);
|
||||
}
|
||||
|
||||
function sort_last_active(a, b) {
|
||||
|
|
Loading…
Reference in New Issue