Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

all-wildcards: Update for "channel" wildcard as preferred to "stream".

Lauryn Menarde2732d95c277
diff --git a/web/src/composebox_typeahead.js b/web/src/composebox_typeahead.js
index c4e9a7b2008..b922c0b0b19 100644
--- a/web/src/composebox_typeahead.js
+++ b/web/src/composebox_typeahead.js
@@ -399,6 +399,8 @@ export function broadcast_mentions() {
if (compose_state.get_message_type() === "private") {
wildcard_mention_array = ["all", "everyone"];
} else if (compose_validate.stream_wildcard_mention_allowed()) {
+ // TODO: Eventually remove "stream" wildcard from typeahead suggestions
+ // once the rename of stream to channel has settled for users.
wildcard_mention_array = ["all", "everyone", "stream", "channel", "topic"];
} else if (compose_validate.topic_wildcard_mention_allowed()) {
wildcard_mention_array = ["topic"];
diff --git a/web/src/people.ts b/web/src/people.ts
index 7157ee471a3..6382e3d111f 100644
--- a/web/src/people.ts
+++ b/web/src/people.ts
@@ -1357,8 +1357,11 @@ export function get_mention_syntax(full_name: string, user_id?: number, silent =
mention += "@**";
}
const wildcard_match = full_name_matches_wildcard_mention(full_name);
- if (wildcard_match && user_id === undefined) {
- mention += util.canonicalize_stream_synonyms(full_name);
+ // TODO: Eventually remove "stream" wildcard from typeahead suggestions
+ // once the rename of stream to channel has settled for users.
+ // Until then, when selected, replace with "channel" wildcard.
+ if (wildcard_match && user_id === undefined && full_name === "stream") {
+ mention += "channel";
} else {
mention += full_name;
}
diff --git a/web/tests/people.test.js b/web/tests/people.test.js
index e1eba803049..3ce2a67730d 100644
--- a/web/tests/people.test.js
+++ b/web/tests/people.test.js
@@ -1150,8 +1150,8 @@ test_people("get_mention_syntax", () => {
// blueslip warning is not raised for wildcard mentions without a user_id
assert.equal(people.get_mention_syntax("all"), "@**all**");
assert.equal(people.get_mention_syntax("everyone", undefined, true), "@_**everyone**");
- assert.equal(people.get_mention_syntax("stream"), "@**stream**");
- assert.equal(people.get_mention_syntax("channel"), "@**stream**");
+ assert.equal(people.get_mention_syntax("stream"), "@**channel**");
+ assert.equal(people.get_mention_syntax("channel"), "@**channel**");
assert.equal(people.get_mention_syntax("topic"), "@**topic**");
people.add_active_user(stephen1);