Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
narrow: Cut dependency on `message_scroll.js` module.
Lalita18b1662cb8b
diff --git a/web/src/hashchange.js b/web/src/hashchange.jsindex 4c8b4d6b8f5..07c0a30ae2b 100644--- a/web/src/hashchange.js+++ b/web/src/hashchange.js@@ -9,6 +9,7 @@ import * as hash_util from "./hash_util";import {$t_html} from "./i18n";import * as info_overlay from "./info_overlay";import * as message_lists from "./message_lists";+import * as message_scroll from "./message_scroll";import * as message_viewport from "./message_viewport";import * as narrow from "./narrow";import * as navigate from "./navigate";@@ -109,7 +110,8 @@ export function save_narrow(operators) {function show_all_message_view() {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();// We need to maybe scroll to the selected message// once we have the proper viewport set updiff --git a/web/src/narrow.js b/web/src/narrow.jsindex 783a3742c7d..ff7a5f2574d 100644--- a/web/src/narrow.js+++ b/web/src/narrow.js@@ -23,7 +23,6 @@ import * as message_helper from "./message_helper";import * as message_list from "./message_list";import {MessageListData} from "./message_list_data";import * as message_lists from "./message_lists";-import * as message_scroll from "./message_scroll";import * as message_store from "./message_store";import * as message_view_header from "./message_view_header";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);}-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,// always use browser_history.go_to_location("#all_messages") to// activate All message narrow.@@ -1027,7 +1026,7 @@ export function deactivate(coming_from_recent_topics = false) {}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// 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.