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:
Ryan Rehman
2020-06-13 15:56:36 +05:30
committed by Tim Abbott
parent bcf4bf1222
commit e0b1096253
6 changed files with 37 additions and 29 deletions

View File

@@ -53,10 +53,6 @@ function process_result(data, opts) {
pm_list.update_private_messages();
recent_topics.process_messages(messages);
if (opts.pre_scroll_cont !== undefined) {
opts.pre_scroll_cont(data);
}
stream_list.maybe_scroll_narrow_into_view();
if (opts.cont !== undefined) {
@@ -225,7 +221,6 @@ exports.load_messages_for_narrow = function (opts) {
num_before: consts.narrow_before,
num_after: consts.narrow_after,
msg_list: msg_list,
pre_scroll_cont: opts.pre_scroll_cont,
cont: function () {
message_scroll.hide_indicators();
opts.cont();