mirror of https://github.com/zulip/zulip.git
compose_ui: Add "(guest)" to user names in compose box placeholder.
This commit adds "(guest)" indicator to guest user names in compose box placeholder if enable_guest_user_indicator setting is enabled in the organization.
This commit is contained in:
parent
127378f0ec
commit
7d7698930a
|
@ -252,6 +252,9 @@ export function compute_placeholder_text(opts) {
|
|||
const recipient_names = recipient_list
|
||||
.map((recipient) => {
|
||||
const user = people.get_by_email(recipient);
|
||||
if (people.should_add_guest_user_indicator(user.user_id)) {
|
||||
return $t({defaultMessage: "{name} (guest)"}, {name: user.full_name});
|
||||
}
|
||||
return user.full_name;
|
||||
})
|
||||
.join(", ");
|
||||
|
|
|
@ -6,6 +6,7 @@ const {$t} = require("./lib/i18n");
|
|||
const {mock_esm, set_global, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const $ = require("./lib/zjquery");
|
||||
const {page_params} = require("./lib/zpage_params");
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
|
@ -248,6 +249,19 @@ run_test("compute_placeholder_text", () => {
|
|||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Message Alice, Bob"}),
|
||||
);
|
||||
|
||||
alice.is_guest = true;
|
||||
page_params.realm_enable_guest_user_indicator = true;
|
||||
assert.equal(
|
||||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Message translated: Alice (guest), Bob"}),
|
||||
);
|
||||
|
||||
page_params.realm_enable_guest_user_indicator = false;
|
||||
assert.equal(
|
||||
compose_ui.compute_placeholder_text(opts),
|
||||
$t({defaultMessage: "Message Alice, Bob"}),
|
||||
);
|
||||
});
|
||||
|
||||
run_test("quote_and_reply", ({override, override_rewire}) => {
|
||||
|
|
Loading…
Reference in New Issue