Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
streams: Hide fake emails in stream creation form.
Sahil Batra16d35f5b4e2c
diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.jsindex 59780d012ed..8d342a1692c 100644--- a/frontend_tests/node_tests/people.js+++ b/frontend_tests/node_tests/people.js@@ -151,18 +151,21 @@ const steven = {const alice1 = {email: "[email protected]",+ delivery_email: "[email protected]",user_id: 202,full_name: "Alice",};const bob = {email: "[email protected]",+ delivery_email: "[email protected]",user_id: 203,full_name: "Bob van Roberts",};const alice2 = {email: "[email protected]",+ delivery_email: "[email protected]",user_id: 204,full_name: "Alice",};@@ -556,15 +559,51 @@ test_people("get_people_for_stream_create", () => {people.add_active_user(bob);people.add_active_user(alice2);assert.equal(people.get_active_human_count(), 4);+ page_params.is_admin = true;+ page_params.realm_email_address_visibility = admins_only;- const others = people.get_people_for_stream_create();- const expected = [+ let others = people.get_people_for_stream_create();+ let expected = [+ {+ email: "[email protected]",+ user_id: alice1.user_id,+ full_name: "Alice",+ checked: false,+ disabled: false,+ show_email: true,+ },+ {+ email: "[email protected]",+ user_id: alice2.user_id,+ full_name: "Alice",+ checked: false,+ disabled: false,+ show_email: true,+ },+ {+ email: "[email protected]",+ user_id: bob.user_id,+ full_name: "Bob van Roberts",+ checked: false,+ disabled: false,+ show_email: true,+ },+ ];+ assert.deepEqual(others, expected);++ page_params.is_admin = false;+ alice1.delivery_email = undefined;+ alice2.delivery_email = undefined;+ bob.delivery_email = undefined;+ others = people.get_people_for_stream_create();+ expected = [{email: "[email protected]",user_id: alice1.user_id,full_name: "Alice",checked: false,disabled: false,+ show_email: false,},{email: "[email protected]",@@ -572,6 +611,7 @@ test_people("get_people_for_stream_create", () => {full_name: "Alice",checked: false,disabled: false,+ show_email: false,},{email: "[email protected]",@@ -579,6 +619,7 @@ test_people("get_people_for_stream_create", () => {full_name: "Bob van Roberts",checked: false,disabled: false,+ show_email: false,},];assert.deepEqual(others, expected);diff --git a/static/js/people.js b/static/js/people.jsindex e349d7805cc..2aeec140eac 100644--- a/static/js/people.js+++ b/static/js/people.js@@ -1069,7 +1069,8 @@ export function get_people_for_stream_create() {for (const person of active_user_dict.values()) {if (!is_my_user_id(person.user_id)) {people_minus_you.push({- email: person.email,+ email: get_visible_email(person),+ show_email: settings_data.show_email(),user_id: person.user_id,full_name: person.full_name,checked: false,diff --git a/static/js/stream_create.js b/static/js/stream_create.jsindex 2bf07b63ea3..91d82f8244a 100644--- a/static/js/stream_create.js+++ b/static/js/stream_create.js@@ -13,6 +13,7 @@ import * as loading from "./loading";import {page_params} from "./page_params";import * as peer_data from "./peer_data";import * as people from "./people";+import * as settings_data from "./settings_data";import * as stream_data from "./stream_data";import * as stream_settings_data from "./stream_settings_data";import * as stream_settings_ui from "./stream_settings_ui";@@ -312,7 +313,8 @@ export function show_new_stream_modal() {// Add current user on top of listconst current_user = people.get_by_user_id(page_params.user_id);all_users.unshift({- email: current_user.email,+ show_email: settings_data.show_email(),+ email: people.get_visible_email(current_user),user_id: current_user.user_id,full_name: current_user.full_name,checked: true,diff --git a/static/templates/new_stream_user.hbs b/static/templates/new_stream_user.hbsindex 81132b011e5..b52589e183b 100644--- a/static/templates/new_stream_user.hbs+++ b/static/templates/new_stream_user.hbs@@ -1,5 +1,5 @@<label class="checkbox add-user-label" id="user_checkbox_{{user_id}}"><input type="checkbox" name="user" {{#if checked}}checked="checked"{{#if disabled}} disabled="disabled"{{/if}}{{/if}} data-user-id="{{user_id}}"/><span></span>- {{full_name}} ({{email}})+ {{full_name}} {{#if show_email}}({{email}}){{else}}({{#tr}}User ID: {user_id}; <em>email hidden</em>{{/tr}}){{/if}}</label>diff --git a/tools/lib/capitalization.py b/tools/lib/capitalization.pyindex 02f219ae301..8b4445a91fa 100644--- a/tools/lib/capitalization.py+++ b/tools/lib/capitalization.py@@ -165,6 +165,8 @@ IGNORED_PHRASES = [# Used in our case studiesr"Technical University of Munich",r"University of California San Diego",+ # Used in stream creation form+ r"email hidden",]# Sort regexes in descending order of their lengths. As a result, the