mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 02:53:52 +00:00
narrow: Show streams:all notice only after "oldest" is found.
The streams:all advertisement notice in search should only appear after all results have been fetched to indicate we've gotten to the beginning of the target feed. The notice gets hidden at the start of `narrow.activate` and is shown just after we've fetched an older batch of messages if the "oldest" message has been found. Previously it would get displayed after the first fetch which takes place from `narrow.activate`. Thus we move this logic to `notifications.hide_or_show_history_limit_message` which gets called after a successful message fetch. Since the home message view contains all the messages we are not required to display this notice. However if it is already shown we hide it as a part of `handle_post_narrow_deactivate_processes`. To accomplish this we need to add `has_found_oldest` key to the `fetch_status` API. We also removed the `pre_scroll_cont` parameter as this was it's only use case and is now redundant.
This commit is contained in:
@@ -187,6 +187,29 @@ exports.hide_or_show_history_limit_message = function (msg_list) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg_list.data.fetch_status.has_found_oldest() &&
|
||||
current_msg_list !== home_msg_list) {
|
||||
const filter = narrow_state.filter();
|
||||
// Potentially display the notice that lets users know
|
||||
// that not all messages were searched. One could
|
||||
// imagine including `filter.is_search()` in these
|
||||
// conditions, but there's a very legitimate use case
|
||||
// for moderation of searching for all messages sent
|
||||
// by a potential spammer user.
|
||||
if (!filter.contains_only_private_messages() &&
|
||||
!filter.includes_full_stream_history() &&
|
||||
!filter.is_personal_filter()) {
|
||||
$(".all-messages-search-caution").show();
|
||||
// Set the link to point to this search with streams:public added.
|
||||
// It's a bit hacky to use the href, but
|
||||
// !filter.includes_full_stream_history() implies streams:public
|
||||
// wasn't already present.
|
||||
$(".all-messages-search-caution a.search-shared-history").attr(
|
||||
"href", window.location.hash.replace("#narrow/", "#narrow/streams/public/")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (msg_list.data.fetch_status.history_limited()) {
|
||||
exports.show_history_limit_message();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user