From 116a0f6f9d6fbb5da0835ccfc3ad5bbf085f4925 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Wed, 10 Nov 2021 19:22:01 +0530 Subject: [PATCH] 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. --- static/js/stream_edit.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js index 284cdcc2db..40c8a73bc3 100644 --- a/static/js/stream_edit.js +++ b/static/js/stream_edit.js @@ -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);