mirror of https://github.com/zulip/zulip.git
narrow: Cut dependency on `message_scroll.js` module.
This commit is contained in:
parent
a434523d1f
commit
a18b1662cb
|
@ -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 up
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue