narrow: Cut dependency on `message_scroll.js` module.

This commit is contained in:
Lalit 2023-06-22 15:13:04 +05:30 committed by Tim Abbott
parent a434523d1f
commit a18b1662cb
2 changed files with 5 additions and 4 deletions

View File

@ -9,6 +9,7 @@ import * as hash_util from "./hash_util";
import {$t_html} from "./i18n"; import {$t_html} from "./i18n";
import * as info_overlay from "./info_overlay"; import * as info_overlay from "./info_overlay";
import * as message_lists from "./message_lists"; import * as message_lists from "./message_lists";
import * as message_scroll from "./message_scroll";
import * as message_viewport from "./message_viewport"; import * as message_viewport from "./message_viewport";
import * as narrow from "./narrow"; import * as narrow from "./narrow";
import * as navigate from "./navigate"; import * as navigate from "./navigate";
@ -109,7 +110,8 @@ export function save_narrow(operators) {
function show_all_message_view() { function show_all_message_view() {
const coming_from_recent_topics = maybe_hide_recent_topics(); const coming_from_recent_topics = maybe_hide_recent_topics();
narrow.deactivate(coming_from_recent_topics); const is_actively_scrolling = message_scroll.is_actively_scrolling();
narrow.deactivate(coming_from_recent_topics, is_actively_scrolling);
top_left_corner.handle_narrow_deactivated(); top_left_corner.handle_narrow_deactivated();
// We need to maybe scroll to the selected message // We need to maybe scroll to the selected message
// once we have the proper viewport set up // once we have the proper viewport set up

View File

@ -23,7 +23,6 @@ import * as message_helper from "./message_helper";
import * as message_list from "./message_list"; import * as message_list from "./message_list";
import {MessageListData} from "./message_list_data"; import {MessageListData} from "./message_list_data";
import * as message_lists from "./message_lists"; import * as message_lists from "./message_lists";
import * as message_scroll from "./message_scroll";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as message_view_header from "./message_view_header"; import * as message_view_header from "./message_view_header";
import * as narrow_banner from "./narrow_banner"; import * as narrow_banner from "./narrow_banner";
@ -1003,7 +1002,7 @@ function handle_post_narrow_deactivate_processes() {
message_feed_top_notices.update_top_of_narrow_notices(message_lists.home); message_feed_top_notices.update_top_of_narrow_notices(message_lists.home);
} }
export function deactivate(coming_from_recent_topics = false) { export function deactivate(coming_from_recent_topics = false, is_actively_scrolling = false) {
// NOTE: Never call this function independently, // NOTE: Never call this function independently,
// always use browser_history.go_to_location("#all_messages") to // always use browser_history.go_to_location("#all_messages") to
// activate All message narrow. // activate All message narrow.
@ -1027,7 +1026,7 @@ export function deactivate(coming_from_recent_topics = false) {
} }
blueslip.debug("Unnarrowed"); blueslip.debug("Unnarrowed");
if (message_scroll.is_actively_scrolling()) { if (is_actively_scrolling) {
// There is no way to intercept in-flight scroll events, and they will // There is no way to intercept in-flight scroll events, and they will
// cause you to end up in the wrong place if you are actively scrolling // cause you to end up in the wrong place if you are actively scrolling
// on an unnarrow. Wait a bit and try again once the scrolling is over. // on an unnarrow. Wait a bit and try again once the scrolling is over.