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.

pm_list: Show unread DMs with deactivated users in unzoomed view.

Evy Kassirerfbd4cbdec374
diff --git a/web/src/pm_list_data.ts b/web/src/pm_list_data.ts
index 2111b729f6c..52783422404 100644
--- a/web/src/pm_list_data.ts
+++ b/web/src/pm_list_data.ts
@@ -167,9 +167,11 @@ export function get_list_info(
// We don't need to filter muted users here, because
// pm_conversations.ts takes care of this for us.
- // Conversations that include any deactivated users should
- // only be visible in the unzoomed view.
- if (conversation.includes_deactivated_user) {
+ // Conversations that include any deactivated users are
+ // hidden from the unzoomed view to declutter the sidebar,
+ // unless they have unread messages since that's still worth
+ // showing.
+ if (conversation.includes_deactivated_user && conversation.unread === 0) {
return false;
}
diff --git a/web/tests/pm_list_data.test.cjs b/web/tests/pm_list_data.test.cjs
index b8e18b6f272..fd14ee90d8b 100644
--- a/web/tests/pm_list_data.test.cjs
+++ b/web/tests/pm_list_data.test.cjs
@@ -494,23 +494,21 @@ test("get_list_info_deactivated_users", ({override}) => {
override(unread, "num_unread_for_user_ids_string", () => 1);
- // Verify with unread messages that conversations with Bob are still
- // not shown in the unzoomed case, and the unread count for more
- // conversations is updated for those 2 conversations.
+ // Verify that with unread messages, conversations with Bob
+ // (deactivated) are shown in the unzoomed case.
list_info = pm_list_data.get_list_info(false);
- assert.deepEqual(list_info.conversations_to_be_shown.length, 11);
- assert.deepEqual(list_info.more_conversations_unread_count, 2);
- // Verify that Bob (deactivated) is not included.
- check_list_info(list_info, 11, 2, [
+ check_list_info(list_info, 13, 0, [
"Cardelio, Iago",
"Alice, Zoe",
"Iago",
"Iago, Zoe",
"Alice, Cardelio",
"Alice, Iago",
+ "Bob, Cardelio",
"Cardelio, Zoe",
"Cardelio",
"Zoe",
+ "Bob",
"Me Myself",
"Alice",
]);