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: Fix duplicate DM row in left sidebar.

Pratik Chanda81abbab0d89d
diff --git a/web/src/pm_list_data.ts b/web/src/pm_list_data.ts
index a6b7037b062..b0b82997117 100644
--- a/web/src/pm_list_data.ts
+++ b/web/src/pm_list_data.ts
@@ -28,7 +28,11 @@ export function get_active_user_ids_string(): string | undefined {
return undefined;
}
- return people.emails_strings_to_user_ids_string(emails);
+ const users_ids_array = people.emails_strings_to_user_ids_array(emails);
+ if (!users_ids_array || users_ids_array.length === 0) {
+ return undefined;
+ }
+ return people.sorted_other_user_ids(users_ids_array).join(",");
}
type DisplayObject = {
diff --git a/web/tests/pm_list_data.test.js b/web/tests/pm_list_data.test.js
index 2659f622915..45592489a10 100644
--- a/web/tests/pm_list_data.test.js
+++ b/web/tests/pm_list_data.test.js
@@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
const {mock_esm, zrequire} = require("./lib/namespace");
const {run_test} = require("./lib/test");
+const blueslip = require("./lib/zblueslip");
const unread = mock_esm("../src/unread");
@@ -216,6 +217,14 @@ test("get_active_user_ids_string", () => {
set_pm_with_filter("[email protected],[email protected]");
assert.equal(pm_list_data.get_active_user_ids_string(), "101,102");
+
+ blueslip.expect("warn", "Unknown emails");
+ set_pm_with_filter("[email protected]");
+ assert.equal(pm_list_data.get_active_user_ids_string(), undefined);
+ blueslip.reset();
+
+ assert.equal(pm_list_data.get_active_user_ids_string(), "101,102");
});
test("get_list_info_unread_messages", ({override}) => {