mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	composebox: Typing "general chat" should suggest empty string topic.
This commit makes sure to suggest "general chat" (in italics) topic on typing "general chat" in compose recipient box.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							e9aa4d0b91
						
					
				
				
					commit
					4ab2c56b7b
				
			@@ -1464,15 +1464,21 @@ export function initialize({
 | 
				
			|||||||
                is_empty_string_topic,
 | 
					                is_empty_string_topic,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        matcher(item: string, query: string): boolean {
 | 
				
			||||||
 | 
					            const matcher = get_topic_matcher(query);
 | 
				
			||||||
 | 
					            return matcher(item);
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        sorter(items: string[], query: string): string[] {
 | 
					        sorter(items: string[], query: string): string[] {
 | 
				
			||||||
            const sorted = typeahead_helper.sorter(query, items, (x) => x);
 | 
					            const sorted = typeahead_helper.sorter(query, items, (x) =>
 | 
				
			||||||
 | 
					                util.get_final_topic_display_name(x),
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
            if (sorted.length > 0 && !sorted.includes(query)) {
 | 
					            if (sorted.length > 0 && !sorted.includes(query)) {
 | 
				
			||||||
                sorted.unshift(query);
 | 
					                sorted.unshift(query);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return sorted;
 | 
					            return sorted;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        option_label(matching_items: string[], item: string): string | false {
 | 
					        option_label(matching_items: string[], item: string): string | false {
 | 
				
			||||||
            if (item !== "" && !matching_items.includes(item)) {
 | 
					            if (!matching_items.includes(item)) {
 | 
				
			||||||
                return `<em>${$t({defaultMessage: "New"})}</em>`;
 | 
					                return `<em>${$t({defaultMessage: "New"})}</em>`;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user