stream_settings: Sort subscriber list by name always.

This commit changes the behavior of subscriber list to
always be sorted by name instead of sorting them by email
when emails are accessible.

This change is fine because we will be using user-level
email address visibility and in that case the email of
some users will be visible and email of some will be not.
This commit is contained in:
Sahil Batra
2021-11-10 19:22:01 +05:30
committed by Tim Abbott
parent 1ce869f16c
commit 116a0f6f9d

View File

@@ -50,13 +50,6 @@ function setup_subscriptions_stream_hash(sub) {
browser_history.update(hash);
}
function compare_by_email(a, b) {
if (a.delivery_email && b.delivery_email) {
return util.strcmp(a.delivery_email, b.delivery_email);
}
return util.strcmp(a.email, b.email);
}
function compare_by_name(a, b) {
return util.strcmp(a.full_name, b.full_name);
}
@@ -362,12 +355,7 @@ export function sort_but_pin_current_user_on_top(users) {
}
const my_user = people.get_by_email(people.my_current_email());
let compare_function;
if (settings_data.show_email()) {
compare_function = compare_by_email;
} else {
compare_function = compare_by_name;
}
const compare_function = compare_by_name;
if (users.includes(my_user)) {
users.splice(users.indexOf(my_user), 1);
users.sort(compare_function);