mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	compose: Do not trigger topic mention if already completed.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							f25f83cc66
						
					
				
				
					commit
					4f03d82ff0
				
			@@ -1288,6 +1288,7 @@ run_test('begins_typeahead', () => {
 | 
				
			|||||||
    assert_typeahead_equals("@**a person** >", false);
 | 
					    assert_typeahead_equals("@**a person** >", false);
 | 
				
			||||||
    assert_typeahead_equals("#**stream**>", ['']); // this is deliberately a blank choice.
 | 
					    assert_typeahead_equals("#**stream**>", ['']); // this is deliberately a blank choice.
 | 
				
			||||||
    assert_typeahead_equals("#**stream** >", ['']);
 | 
					    assert_typeahead_equals("#**stream** >", ['']);
 | 
				
			||||||
 | 
					    assert_typeahead_equals("#**Sweden>some topic** >", false); // Already completed a topic.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // topic_list
 | 
					    // topic_list
 | 
				
			||||||
    var sweden_topics_to_show = topic_data.get_recent_names(1); //includes "more ice"
 | 
					    var sweden_topics_to_show = topic_data.get_recent_names(1); //includes "more ice"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -559,7 +559,7 @@ exports.compose_content_begins_typeahead = function (query) {
 | 
				
			|||||||
    if (this.options.completions.topic) {
 | 
					    if (this.options.completions.topic) {
 | 
				
			||||||
        // Stream regex modified from marked.js
 | 
					        // Stream regex modified from marked.js
 | 
				
			||||||
        // Matches '#**stream name** >' at the end of a split.
 | 
					        // 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]);
 | 
					        var should_jump_inside_typeahead = stream_regex.test(split[0]);
 | 
				
			||||||
        if (should_jump_inside_typeahead) {
 | 
					        if (should_jump_inside_typeahead) {
 | 
				
			||||||
            this.completing = 'topic_jump';
 | 
					            this.completing = 'topic_jump';
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user