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.

hotkey: Fix go to unread followed topic in muted stream.

Prakhar Pratyush4df1692294ae
diff --git a/web/src/topic_generator.js b/web/src/topic_generator.js
index 3da8f919b2c..c85ba10527a 100644
--- a/web/src/topic_generator.js
+++ b/web/src/topic_generator.js
@@ -56,6 +56,12 @@ export function get_next_topic(curr_stream, curr_topic, only_followed_topics) {
if (!stream_data.is_stream_muted_by_name(stream_name)) {
return true;
}
+ if (only_followed_topics) {
+ // We can use Shift + N to go to unread followed topic in muted stream.
+ const stream_id = stream_data.get_stream_id(stream_name);
+ const topics = stream_topic_history.get_recent_topic_names(stream_id);
+ return topics.some((topic) => user_topics.is_topic_followed(stream_id, topic));
+ }
if (stream_name === curr_stream) {
// We can use n within a muted stream if we are
// currently narrowed to it.
diff --git a/web/tests/topic_generator.test.js b/web/tests/topic_generator.test.js
index b6c6b84a0cd..9a39e81835b 100644
--- a/web/tests/topic_generator.test.js
+++ b/web/tests/topic_generator.test.js
@@ -121,6 +121,14 @@ run_test("topics", ({override}) => {
topic: "followed",
});
+ // Shift + N takes the user to next unread followed topic,
+ // even if the stream is muted.
+ next_item = tg.get_next_topic("announce", "whatever", true);
+ assert.deepEqual(next_item, {
+ stream: "muted",
+ topic: "followed",
+ });
+
next_item = tg.get_next_topic("muted", "whatever", true);
assert.deepEqual(next_item, {
stream: "muted",