topic_list: Update the order of "Followed" topics in the muted stream.

For sorting topics in the left sidebar topics list, the "Followed"
topics are treated the same as "Unmuted" topics.

In a muted stream and not zoomed state:
* followed/unmuted topics at the top.

In an unmuted stream or zoomed state in a muted stream:
* normal recency sorting

The reason is that the "Followed" topics have a tier of interest
above being unmuted, so they shouldn't lie below the "Unmuted" topics
in the list.
This commit is contained in:
Prakhar Pratyush
2023-08-25 21:50:02 +05:30
committed by Tim Abbott
parent 5d069b7d7a
commit 20886b80d9
2 changed files with 5 additions and 5 deletions

View File

@@ -128,13 +128,13 @@ export function get_list_info(stream_id, zoomed, search_term) {
}
if (stream_muted && !zoomed) {
const unmuted_topics = topic_names.filter((topic) =>
user_topics.is_topic_unmuted(stream_id, topic),
const unmuted_or_followed_topics = topic_names.filter((topic) =>
user_topics.is_topic_unmuted_or_followed(stream_id, topic),
);
choose_topics(stream_id, unmuted_topics, zoomed, topic_choice_state);
choose_topics(stream_id, unmuted_or_followed_topics, zoomed, topic_choice_state);
const other_topics = topic_names.filter(
(topic) => !user_topics.is_topic_unmuted(stream_id, topic),
(topic) => !user_topics.is_topic_unmuted_or_followed(stream_id, topic),
);
choose_topics(stream_id, other_topics, zoomed, topic_choice_state);
} else {

View File

@@ -265,7 +265,7 @@ test("get_list_info unreads", ({override}) => {
// this should make topic 5 at top in items array
general.is_muted = true;
add_unreads("topic 5", 1);
override(user_topics, "is_topic_unmuted", (stream_id, topic_name) => {
override(user_topics, "is_topic_unmuted_or_followed", (stream_id, topic_name) => {
assert.equal(stream_id, general.stream_id);
return topic_name === "topic 5";
});