compose: Do not trigger topic mention if already completed.

This commit is contained in:
Rohitt Vashishtha
2019-07-25 22:34:54 +05:30
committed by Tim Abbott
parent f25f83cc66
commit 4f03d82ff0
2 changed files with 2 additions and 1 deletions

View File

@@ -1288,6 +1288,7 @@ run_test('begins_typeahead', () => {
assert_typeahead_equals("@**a person** >", false);
assert_typeahead_equals("#**stream**>", ['']); // this is deliberately a blank choice.
assert_typeahead_equals("#**stream** >", ['']);
assert_typeahead_equals("#**Sweden>some topic** >", false); // Already completed a topic.
// topic_list
var sweden_topics_to_show = topic_data.get_recent_names(1); //includes "more ice"

View File

@@ -559,7 +559,7 @@ exports.compose_content_begins_typeahead = function (query) {
if (this.options.completions.topic) {
// Stream regex modified from marked.js
// Matches '#**stream name** >' at the end of a split.
var stream_regex = /#\*\*([^\*]+)\*\*\s?>$/;
var stream_regex = /#\*\*([^\*>]+)\*\*\s?>$/;
var should_jump_inside_typeahead = stream_regex.test(split[0]);
if (should_jump_inside_typeahead) {
this.completing = 'topic_jump';