Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
composebox_typeahead: Move wildcard string to secondary in @-mention.
Pratik Chanda967243b2db8d
diff --git a/web/src/composebox_typeahead.ts b/web/src/composebox_typeahead.tsindex 042d8962856..d13095ee4b2 100644--- a/web/src/composebox_typeahead.ts+++ b/web/src/composebox_typeahead.ts@@ -485,7 +485,8 @@ export function broadcast_mentions(): PseudoMentionUser[] {}return wildcard_mention_array.map((mention, idx) => ({- special_item_text: `${mention} (${get_wildcard_string(mention)})`,+ special_item_text: mention,+ secondary_text: get_wildcard_string(mention),email: mention,// Always sort above, under the assumption that names willdiff --git a/web/src/people.ts b/web/src/people.tsindex 37fcdb1dbe3..3bc6e661024 100644--- a/web/src/people.ts+++ b/web/src/people.ts@@ -33,6 +33,7 @@ export type SenderInfo = User & {export type PseudoMentionUser = {special_item_text: string;email: string;+ secondary_text: string;pm_recipient_count: number;full_name: string;idx: number;diff --git a/web/src/typeahead_helper.ts b/web/src/typeahead_helper.tsindex 114ed36b4c2..309a6a41c21 100644--- a/web/src/typeahead_helper.ts+++ b/web/src/typeahead_helper.ts@@ -125,6 +125,7 @@ export function render_person(person: UserPillData | UserOrMentionPillData): strif (person.type === "broadcast") {return render_typeahead_item({primary: person.user.special_item_text,+ secondary: person.user.secondary_text,is_person: true,});}diff --git a/web/tests/composebox_typeahead.test.js b/web/tests/composebox_typeahead.test.jsindex 921dd793bec..da5aed45c67 100644--- a/web/tests/composebox_typeahead.test.js+++ b/web/tests/composebox_typeahead.test.js@@ -114,11 +114,16 @@ run_test("verify wildcard mentions typeahead for stream message", () => {assert.equal(mention_topic.email, "topic");assert.equal(mention_topic.full_name, "topic");- assert.equal(mention_all.special_item_text, "all (translated: Notify channel)");- assert.equal(mention_everyone.special_item_text, "everyone (translated: Notify channel)");- assert.equal(mention_stream.special_item_text, "stream (translated: Notify channel)");- assert.equal(mention_channel.special_item_text, "channel (translated: Notify channel)");- assert.equal(mention_topic.special_item_text, "topic (translated: Notify topic)");+ assert.equal(mention_all.special_item_text, "all");+ assert.equal(mention_all.secondary_text, "translated: Notify channel");+ assert.equal(mention_everyone.special_item_text, "everyone");+ assert.equal(mention_everyone.secondary_text, "translated: Notify channel");+ assert.equal(mention_stream.special_item_text, "stream");+ assert.equal(mention_stream.secondary_text, "translated: Notify channel");+ assert.equal(mention_channel.special_item_text, "channel");+ assert.equal(mention_channel.secondary_text, "translated: Notify channel");+ assert.equal(mention_topic.special_item_text, "topic");+ assert.equal(mention_topic.secondary_text, "translated: Notify topic");compose_validate.stream_wildcard_mention_allowed = () => false;compose_validate.topic_wildcard_mention_allowed = () => true;@@ -142,8 +147,10 @@ run_test("verify wildcard mentions typeahead for direct message", () => {assert.equal(mention_everyone.email, "everyone");assert.equal(mention_everyone.full_name, "everyone");- assert.equal(mention_all.special_item_text, "all (translated: Notify recipients)");- assert.equal(mention_everyone.special_item_text, "everyone (translated: Notify recipients)");+ assert.equal(mention_all.special_item_text, "all");+ assert.equal(mention_all.secondary_text, "translated: Notify recipients");+ assert.equal(mention_everyone.special_item_text, "everyone");+ assert.equal(mention_all.secondary_text, "translated: Notify recipients");});const emoji_stadium = {