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.

minor: Don't export unread_topic_counter.

Steve Howelldd7420ff1125
diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js
index 72b24122292..73f5853f058 100644
--- a/frontend_tests/node_tests/recent_topics.js
+++ b/frontend_tests/node_tests/recent_topics.js
@@ -135,14 +135,12 @@ mock_module("top_left_corner", {
narrow_to_recent_topics: noop,
});
mock_module("unread", {
- unread_topic_counter: {
- get: (stream_id, topic) => {
- if (stream_id === 1 && topic === "topic-1") {
- // Only stream1, topic-1 is read.
- return 0;
- }
- return 1;
- },
+ num_unread_for_topic: (stream_id, topic) => {
+ if (stream_id === 1 && topic === "topic-1") {
+ // Only stream1, topic-1 is read.
+ return 0;
+ }
+ return 1;
},
});
diff --git a/static/js/recent_topics.js b/static/js/recent_topics.js
index 886fa25b448..103d08d7985 100644
--- a/static/js/recent_topics.js
+++ b/static/js/recent_topics.js
@@ -221,7 +221,7 @@ function format_topic(topic_data) {
const topic_muted = Boolean(muting.is_topic_muted(stream_id, topic));
const stream_muted = stream_data.is_muted(stream_id);
const muted = topic_muted || stream_muted;
- const unread_count = unread.unread_topic_counter.get(stream_id, topic);
+ const unread_count = unread.num_unread_for_topic(stream_id, topic);
// Display in most recent sender first order
const all_senders = recent_senders.get_topic_recent_senders(stream_id, topic);
@@ -299,7 +299,7 @@ export function filters_should_hide_topic(topic_data) {
}
if (filters.has("unread")) {
- const unreadCount = unread.unread_topic_counter.get(msg.stream_id, msg.topic);
+ const unreadCount = unread.num_unread_for_topic(msg.stream_id, msg.topic);
if (unreadCount === 0) {
return true;
}
diff --git a/static/js/unread.js b/static/js/unread.js
index d1df3047924..f9464c89a91 100644
--- a/static/js/unread.js
+++ b/static/js/unread.js
@@ -24,6 +24,7 @@ export function set_messages_read_in_narrow(value) {
messages_read_in_narrow = value;
}
+export const unread_mentions_counter = new Set();
const unread_messages = new Set();
class Bucketer {
@@ -183,7 +184,7 @@ class UnreadPMCounter {
return util.sorted_ids(ids);
}
}
-export const unread_pm_counter = new UnreadPMCounter();
+const unread_pm_counter = new UnreadPMCounter();
function make_per_stream_bucketer() {
return new Bucketer({
@@ -369,8 +370,7 @@ class UnreadTopicCounter {
return id_set.size !== 0;
}
}
-export const unread_topic_counter = new UnreadTopicCounter();
-export const unread_mentions_counter = new Set();
+const unread_topic_counter = new UnreadTopicCounter();
export function message_unread(message) {
if (message === undefined) {