mirror of https://github.com/zulip/zulip.git
topic_generator: Fix navigating to next normal topic in muted streams.
This commit is contained in:
parent
82191872a4
commit
9d0375cac1
|
@ -1,3 +1,6 @@
|
|||
import _ from "lodash";
|
||||
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as pm_conversations from "./pm_conversations";
|
||||
import * as stream_data from "./stream_data";
|
||||
import * as stream_list_sort from "./stream_list_sort";
|
||||
|
@ -75,16 +78,28 @@ export function get_next_topic(curr_stream, curr_topic, only_followed_topics) {
|
|||
|
||||
function get_unmuted_topics(stream_name) {
|
||||
const stream_id = stream_data.get_stream_id(stream_name);
|
||||
let topics = stream_topic_history.get_recent_topic_names(stream_id);
|
||||
const topics = stream_topic_history.get_recent_topic_names(stream_id);
|
||||
|
||||
if (stream_data.is_stream_muted_by_name(stream_name)) {
|
||||
topics = topics.filter((topic) =>
|
||||
if (
|
||||
narrow_state.active() &&
|
||||
narrow_state.stream_id() === stream_id &&
|
||||
_.isEqual(narrow_state.filter().sorted_term_types(), ["stream", "topic"]) &&
|
||||
!user_topics.is_topic_unmuted_or_followed(stream_id, narrow_state.topic())
|
||||
) {
|
||||
// Here we're using N within a muted stream starting from
|
||||
// a muted topic; advance to the next not-explicitly-muted
|
||||
// unread topic in the stream, to allow using N within
|
||||
// muted streams. We'll jump back into the normal mode if
|
||||
// we land in a followed/unmuted topic, but that's OK.
|
||||
|
||||
/* istanbul ignore next */
|
||||
return topics.filter((topic) => !user_topics.is_topic_muted(stream_id, topic));
|
||||
} else if (stream_data.is_stream_muted_by_name(stream_name)) {
|
||||
return topics.filter((topic) =>
|
||||
user_topics.is_topic_unmuted_or_followed(stream_id, topic),
|
||||
);
|
||||
} else {
|
||||
topics = topics.filter((topic) => !user_topics.is_topic_muted(stream_id, topic));
|
||||
}
|
||||
return topics;
|
||||
return topics.filter((topic) => !user_topics.is_topic_muted(stream_id, topic));
|
||||
}
|
||||
|
||||
function get_followed_topics(stream_name) {
|
||||
|
|
Loading…
Reference in New Issue