compose banner: Consolidate two functions that clear success banners.

Previously notifications.clear_compose_notifications was used accross
the codebase. Since introducing the new
compose_banner.clear_message_sent_banners function, the two functions
are similar enough that we can just use clear_message_sent_banners
everywhere. This commit also moves scroll_to_message_banner_message_id
to compose_banner.
This commit is contained in:
evykassirer
2023-02-01 18:38:52 -08:00
committed by Tim Abbott
parent ea9c4682a8
commit 5f59ea0036
9 changed files with 26 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
import $ from "jquery";
import _ from "lodash";
import * as compose_banner from "./compose_banner";
import * as floating_recipient_bar from "./floating_recipient_bar";
import * as hash_util from "./hash_util";
import * as loading from "./loading";
@@ -9,7 +10,6 @@ import * as message_lists from "./message_lists";
import * as message_viewport from "./message_viewport";
import * as narrow_banner from "./narrow_banner";
import * as narrow_state from "./narrow_state";
import * as notifications from "./notifications";
import * as recent_topics_util from "./recent_topics_util";
import * as unread from "./unread";
import * as unread_ops from "./unread_ops";
@@ -195,12 +195,12 @@ export function scroll_finished() {
return;
}
if (notifications.scroll_to_message_banner_message_id !== null) {
if (compose_banner.scroll_to_message_banner_message_id !== null) {
const $message_row = message_lists.current.get_row(
notifications.scroll_to_message_banner_message_id,
compose_banner.scroll_to_message_banner_message_id,
);
if ($message_row.length > 0 && !message_viewport.is_message_below_viewport($message_row)) {
notifications.clear_compose_notifications();
compose_banner.clear_message_sent_banners();
}
}