mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	search-suggestions: Use narrowed_by_topic for empty search query.
Use narrow_state.narrowed_by_topic when getting suggestions for an empty search query to check if the current filter corresponds to a specific channel/topic conversation. This is functionally equivalent to what we have been doing since these suggestions are only added when the search query is empty. For narrows that have a term with a near operator or additional filter terms (is:starred, has:link, etc.), the search query would not be empty when constructing the attacher for the search box suggestions.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							1706aa5c1e
						
					
				
				
					commit
					11dcf3bef7
				
			@@ -862,7 +862,11 @@ function suggestion_search_string(suggestion_line: SuggestionLine): string {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function suggestions_for_empty_search_query(): SuggestionLine[] {
 | 
			
		||||
    if (narrow_state.stream_id() && narrow_state.topic() !== undefined) {
 | 
			
		||||
    // Since the context here is an **empty** search query, we assume
 | 
			
		||||
    // that there is no `near:` operator. So it's safe to use
 | 
			
		||||
    // functions like narrowed_by_topic_reply that return false on
 | 
			
		||||
    // conversation views with `near` or `with` operators.
 | 
			
		||||
    if (narrow_state.narrowed_by_topic_reply()) {
 | 
			
		||||
        return [
 | 
			
		||||
            get_default_suggestion_line([
 | 
			
		||||
                {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user