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.

filter: Use specific title for DM conversation with self.

Harshbdf2317b4091
diff --git a/web/src/filter.ts b/web/src/filter.ts
index c6ba52c5151..bdc091aeb7f 100644
--- a/web/src/filter.ts
+++ b/web/src/filter.ts
@@ -1412,6 +1412,12 @@ export class Filter {
(term_types.length === 1 && _.isEqual(term_types, ["dm"]))
) {
const emails = this.operands("dm")[0]!.split(",");
+ if (emails.length === 1) {
+ const user = people.get_by_email(emails[0]!);
+ if (user && people.is_direct_message_conversation_with_self([user.user_id])) {
+ return $t({defaultMessage: "Messages with yourself"});
+ }
+ }
const names = emails.map((email) => {
const person = people.get_by_email(email);
if (!person) {
diff --git a/web/tests/filter.test.cjs b/web/tests/filter.test.cjs
index 18bf3eca94a..21545e32aff 100644
--- a/web/tests/filter.test.cjs
+++ b/web/tests/filter.test.cjs
@@ -2341,6 +2341,7 @@ test("navbar_helpers", ({override}) => {
{operator: "dm", operand: "[email protected]"},
{operator: "with", operand: "12"},
];
+ const dm_with_self = [{operator: "dm", operand: "[email protected]"}];
const dm_group = [{operator: "dm", operand: "[email protected],[email protected]"}];
const dm_with_guest = [{operator: "dm", operand: "[email protected]"}];
const dm_with_muted_user = [{operator: "dm", operand: "[email protected]"}];
@@ -2621,6 +2622,13 @@ test("navbar_helpers", ({override}) => {
title: properly_separated_names([joe.full_name]),
redirect_url_with_search: "#",
},
+ {
+ terms: dm_with_self,
+ is_common_narrow: true,
+ zulip_icon: "user",
+ title: "translated: Messages with yourself",
+ redirect_url_with_search: "/#narrow/dm/30-Me-Myself",
+ },
];
override(realm, "realm_enable_guest_user_indicator", true);