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.

hash_util: Fix "Invalid URL" for dm-including/me links.

Aman Agrawal21eeecd38dc2
diff --git a/web/src/hash_util.ts b/web/src/hash_util.ts
index d4715d51c04..f7bb5102764 100644
--- a/web/src/hash_util.ts
+++ b/web/src/hash_util.ts
@@ -82,6 +82,7 @@ export function decode_operand(
case "sender":
return people.my_current_user_id();
case "dm":
+ case "dm-including":
return [people.my_current_user_id()];
}
} else if (operator === "dm-including" || operator === "dm") {
diff --git a/web/tests/hash_util.test.cjs b/web/tests/hash_util.test.cjs
index 1016f77ca97..f6daad93e30 100644
--- a/web/tests/hash_util.test.cjs
+++ b/web/tests/hash_util.test.cjs
@@ -238,6 +238,17 @@ run_test("test_parse_narrow", () => {
]);
});
+run_test("parse_narrow_me_operand", () => {
+ assert.deepEqual(hash_util.parse_narrow(["narrow", "sender", "me"]), [
+ {negated: false, operator: "sender", operand: me.user_id},
+ ]);
+ for (const operator of ["dm", "dm-including"]) {
+ assert.deepEqual(hash_util.parse_narrow(["narrow", operator, "me"]), [
+ {negated: false, operator, operand: [me.user_id]},
+ ]);
+ }
+});
+
run_test("parse_narrow_user_slug", () => {
// Each member of a user slug's list is a user ID. One that
// isn't, like a known user's email, is an unknown user. So is