Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

unread_ui: Rename functions names to offer a general clarity.

Joeluteffbe6e870a09
diff --git a/web/src/message_scroll.js b/web/src/message_scroll.js
index ad9643e90c1..eb7deb4e06d 100644
--- a/web/src/message_scroll.js
+++ b/web/src/message_scroll.js
@@ -272,7 +272,7 @@ export function initialize() {
// The below checks might seem redundant, but it's
// possible this logic, which runs after a delay, lost
// a race with switching to another view, like Recent
- // Topics, and we don't want to displ[ay this banner
+ // Topics, and we don't want to display this banner
// in such a view.
//
// This can likely be fixed more cleanly with another approach.
diff --git a/web/src/narrow.js b/web/src/narrow.js
index 3d02acbd75c..31627d3c806 100644
--- a/web/src/narrow.js
+++ b/web/src/narrow.js
@@ -178,7 +178,7 @@ export function reset_ui_state() {
narrow_banner.hide_empty_narrow_message();
message_scroll.hide_top_of_narrow_notices();
message_scroll.hide_indicators();
- unread_ui.reset_mark_as_read_turned_off_banner();
+ unread_ui.reset_unread_banner();
}
export function handle_middle_pane_transition() {
diff --git a/web/src/recent_topics_ui.js b/web/src/recent_topics_ui.js
index b5ed684764d..f57bc832403 100644
--- a/web/src/recent_topics_ui.js
+++ b/web/src/recent_topics_ui.js
@@ -884,7 +884,7 @@ export function show() {
set_visible(true);
$(".header").css("padding-bottom", "0px");
- unread_ui.hide_mark_as_read_turned_off_banner();
+ unread_ui.hide_unread_banner();
// We want to show `new stream message` instead of
// `new topic`, which we are already doing in this
diff --git a/web/src/stream_events.js b/web/src/stream_events.js
index 89bc98cb8c3..421771affc4 100644
--- a/web/src/stream_events.js
+++ b/web/src/stream_events.js
@@ -173,7 +173,7 @@ export function mark_unsubscribed(sub) {
// This update would likely be better implemented by having it
// disappear whenever no unread messages remain.
- unread_ui.hide_mark_as_read_turned_off_banner();
+ unread_ui.hide_unread_banner();
}
// Unread messages in the now-unsubscribe stream need to be
diff --git a/web/src/unread_ui.js b/web/src/unread_ui.js
index b3f482884bd..44d63a367e8 100644
--- a/web/src/unread_ui.js
+++ b/web/src/unread_ui.js
@@ -13,20 +13,20 @@ import * as topic_list from "./topic_list";
import * as unread from "./unread";
import {notify_server_messages_read} from "./unread_ops";
-let user_closed_mark_as_read_turned_off_banner = false;
-export function hide_mark_as_read_turned_off_banner() {
+let user_closed_unread_banner = false;
+export function hide_unread_banner() {
// Use visibility instead of hide() to prevent messages on the screen from
// shifting vertically.
$("#mark_as_read_turned_off_banner").toggleClass("invisible", true);
}
-export function reset_mark_as_read_turned_off_banner() {
- hide_mark_as_read_turned_off_banner();
- user_closed_mark_as_read_turned_off_banner = false;
+export function reset_unread_banner() {
+ hide_unread_banner();
+ user_closed_unread_banner = false;
}
export function notify_messages_remain_unread() {
- if (!user_closed_mark_as_read_turned_off_banner) {
+ if (!user_closed_unread_banner) {
$("#mark_as_read_turned_off_banner").toggleClass("invisible", false);
}
}
@@ -98,7 +98,7 @@ export function initialize() {
update_unread_counts();
$("#mark_as_read_turned_off_banner").html(render_mark_as_read_turned_off_banner());
- hide_mark_as_read_turned_off_banner();
+ hide_unread_banner();
$("#mark_view_read").on("click", () => {
// Mark all messages in the current view as read.
//
@@ -112,10 +112,10 @@ export function initialize() {
// New messages received may be marked as read based on narrow type.
message_lists.current.resume_reading();
- hide_mark_as_read_turned_off_banner();
+ hide_unread_banner();
});
$("#mark_as_read_close").on("click", () => {
- hide_mark_as_read_turned_off_banner();
- user_closed_mark_as_read_turned_off_banner = true;
+ hide_unread_banner();
+ user_closed_unread_banner = true;
});
}
diff --git a/web/tests/recent_topics.test.js b/web/tests/recent_topics.test.js
index 6868704286d..c2704ee459e 100644
--- a/web/tests/recent_topics.test.js
+++ b/web/tests/recent_topics.test.js
@@ -110,7 +110,7 @@ mock_esm("../src/user_topics", {
});
const narrow = mock_esm("../src/narrow", {
update_narrow_title: noop,
- hide_mark_as_read_turned_off_banner: noop,
+ hide_unread_banner: noop,
handle_middle_pane_transition: noop,
has_shown_message_list_view: true,
});
diff --git a/web/tests/stream_events.test.js b/web/tests/stream_events.test.js
index a195ffe0ea4..35008adb271 100644
--- a/web/tests/stream_events.test.js
+++ b/web/tests/stream_events.test.js
@@ -410,7 +410,7 @@ test("mark_unsubscribed (render_title_area)", ({override}) => {
override(stream_list, "remove_sidebar_row", noop);
override(stream_list, "update_subscribe_to_more_streams_link", noop);
override(unread_ui, "update_unread_counts", noop);
- override(unread_ui, "hide_mark_as_read_turned_off_banner", noop);
+ override(unread_ui, "hide_unread_banner", noop);
$("#streams_overlay_container .stream-row:not(.notdisplayed)").length = 0;