mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 18:06:44 +00:00
composebox_typeahead: Move wildcard string to secondary in @-mention.
Earlier, in typeahead suggestions for wildcard mention, we rendered wildcard string as primary text inside parentheses. This commit separates the wildcard string as secondary_text to be rendered without parentheses using styles like channel description. Fixes: zulip#31245.
This commit is contained in:
committed by
Tim Abbott
parent
c84ff59dc9
commit
967243b2db
@@ -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 will
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -125,6 +125,7 @@ export function render_person(person: UserPillData | UserOrMentionPillData): str
|
||||
if (person.type === "broadcast") {
|
||||
return render_typeahead_item({
|
||||
primary: person.user.special_item_text,
|
||||
secondary: person.user.secondary_text,
|
||||
is_person: true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user