Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
people: User "Muted user" placeholder for muted usernames.
Abhijeet Prasad Bodas22053d839938
diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.jsindex f8ac4f1a935..9fcdd0f1b01 100644--- a/frontend_tests/node_tests/people.js+++ b/frontend_tests/node_tests/people.js@@ -14,6 +14,7 @@ const {page_params} = require("../zjsunit/zpage_params");const message_user_ids = mock_esm("../../static/js/message_user_ids");+const muting = zrequire("muting");const people = zrequire("people");const settings_config = zrequire("settings_config");const visibility = settings_config.email_address_visibility_values;@@ -57,6 +58,7 @@ function initialize() {people.add_active_user({...me});people.initialize_current_user(me.user_id);set_email_visibility(admins_only);+ muting.set_muted_users([]);}function test_people(label, f) {@@ -410,16 +412,16 @@ test_people("get_display_full_names", () => {people.add_active_user(steven);people.add_active_user(bob);people.add_active_user(charles);- const names = people.get_display_full_names([- me.user_id,- steven.user_id,- bob.user_id,- charles.user_id,- ]);+ const user_ids = [me.user_id, steven.user_id, bob.user_id, charles.user_id];+ let names = people.get_display_full_names(user_ids);// This doesn't do anything special for the current user. The caller has// to take care of such cases and do the appropriate.assert.deepEqual(names, ["Me Myself", "Steven", "Bob van Roberts", "Charles Dickens"]);++ muting.add_muted_user(charles.user_id);+ names = people.get_display_full_names(user_ids);+ assert.deepEqual(names, ["Me Myself", "Steven", "Bob van Roberts", "translated: Muted user"]);});test_people("my_custom_profile_data", () => {diff --git a/static/js/people.js b/static/js/people.jsindex 200ac2e78cb..34db7a32750 100644--- a/static/js/people.js+++ b/static/js/people.js@@ -8,6 +8,7 @@ import * as blueslip from "./blueslip";import {FoldDict} from "./fold_dict";import {$t} from "./i18n";import * as message_user_ids from "./message_user_ids";+import * as muting from "./muting";import * as reload_state from "./reload_state";import * as settings_config from "./settings_config";import * as settings_data from "./settings_data";@@ -316,6 +317,10 @@ export function get_display_full_names(user_ids) {return "?";}+ if (muting.is_user_muted(user_id)) {+ return $t({defaultMessage: "Muted user"});+ }+return person.full_name;});}