mirror of
https://github.com/zulip/zulip.git
synced 2025-10-25 00:53:56 +00:00
narrow-banner: Use shared function for empty narrows with search data.
This commit is contained in:
committed by
Tim Abbott
parent
9b787fc3db
commit
ad4732adb5
@@ -81,7 +81,7 @@ const MUTED_TOPICS_IN_CHANNEL_EMPTY_BANNER = {
|
|||||||
|
|
||||||
const NO_SEARCH_RESULTS_TITLE = $t({defaultMessage: "No search results."});
|
const NO_SEARCH_RESULTS_TITLE = $t({defaultMessage: "No search results."});
|
||||||
|
|
||||||
function retrieve_search_query_data(current_filter: Filter): SearchData {
|
function empty_search_query_banner(current_filter: Filter): NarrowBannerData {
|
||||||
// when search bar contains multiple filters, only retrieve search queries
|
// when search bar contains multiple filters, only retrieve search queries
|
||||||
const search_query = current_filter.operands("search")[0];
|
const search_query = current_filter.operands("search")[0];
|
||||||
const query_words = search_query!.split(" ");
|
const query_words = search_query!.split(" ");
|
||||||
@@ -121,7 +121,10 @@ function retrieve_search_query_data(current_filter: Filter): SearchData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return search_string_result;
|
return {
|
||||||
|
title: NO_SEARCH_RESULTS_TITLE,
|
||||||
|
search_data: search_string_result,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pick_empty_narrow_banner(current_filter: Filter): NarrowBannerData {
|
export function pick_empty_narrow_banner(current_filter: Filter): NarrowBannerData {
|
||||||
@@ -204,12 +207,9 @@ export function pick_empty_narrow_banner(current_filter: Filter): NarrowBannerDa
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// For empty stream searches within other narrows, we display the stop words
|
// For empty search queries, we display excluded stop words
|
||||||
if (current_filter.operands("search").length > 0) {
|
if (current_filter.operands("search").length > 0) {
|
||||||
return {
|
return empty_search_query_banner(current_filter);
|
||||||
title: NO_SEARCH_RESULTS_TITLE,
|
|
||||||
search_data: retrieve_search_query_data(current_filter),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -345,10 +345,7 @@ export function pick_empty_narrow_banner(current_filter: Filter): NarrowBannerDa
|
|||||||
}
|
}
|
||||||
case "search": {
|
case "search": {
|
||||||
// You are narrowed to empty search results.
|
// You are narrowed to empty search results.
|
||||||
return {
|
return empty_search_query_banner(current_filter);
|
||||||
title: NO_SEARCH_RESULTS_TITLE,
|
|
||||||
search_data: retrieve_search_query_data(current_filter),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
case "dm": {
|
case "dm": {
|
||||||
if (!people.is_valid_bulk_emails_for_compose(first_operand.split(","))) {
|
if (!people.is_valid_bulk_emails_for_compose(first_operand.split(","))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user