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.

composebox_typeahead: Avoid opening on multiline stream/topic names.

Kislay Vermafadbca1b7203
diff --git a/web/src/composebox_typeahead.ts b/web/src/composebox_typeahead.ts
index fc77d2c444e..dd96900e329 100644
--- a/web/src/composebox_typeahead.ts
+++ b/web/src/composebox_typeahead.ts
@@ -920,7 +920,7 @@ export function get_candidates(
}
// Matches '#**stream name>some text' at the end of a split.
- const stream_topic_regex = /#\*\*([^*>]+)>([^*]*)$/;
+ const stream_topic_regex = /#\*\*([^*>]+)>([^*\n]*)$/;
const should_begin_typeahead = stream_topic_regex.test(split[0]);
if (should_begin_typeahead) {
completing = "topic_list";
diff --git a/web/tests/composebox_typeahead.test.cjs b/web/tests/composebox_typeahead.test.cjs
index 0bbaa96fc62..cbdddd20904 100644
--- a/web/tests/composebox_typeahead.test.cjs
+++ b/web/tests/composebox_typeahead.test.cjs
@@ -1862,6 +1862,7 @@ test("begins_typeahead", ({override, override_rewire}) => {
}
assert_typeahead_equals("#**Sweden>more ice", typed_topics(["more ice", "even more ice"]));
assert_typeahead_equals("#**Sweden>totally new topic", typed_topics(["totally new topic"]));
+ assert_typeahead_equals("#**Sweden>\n\nmore ice", typed_topics([]));
// time_jump
const time_jump = [