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.

url_decoding: Handle mentions operator in decode_narrow_operand.

Aman Agrawal23b078f5144b
diff --git a/zerver/lib/url_decoding.py b/zerver/lib/url_decoding.py
index aa60e2df2be..8d70da289ee 100644
--- a/zerver/lib/url_decoding.py
+++ b/zerver/lib/url_decoding.py
@@ -88,7 +88,7 @@ def decode_hash_component(string: str) -> str:
def decode_narrow_operand(operator: str, operand: str) -> str | int | list[int]:
# These have the similar slug formatting for their operands which
# contain object ID(s).
- if operator in ["dm-including", "dm", "sender", "channel"]:
+ if operator in ["dm-including", "dm", "mentions", "sender", "channel"]:
result = parse_recipient_slug(operand)
return result[0] if isinstance(result, tuple) else ""
diff --git a/zerver/tests/fixtures/narrow_url_to_narrow_terms.json b/zerver/tests/fixtures/narrow_url_to_narrow_terms.json
index f99ec84af56..397ec5db2ec 100644
--- a/zerver/tests/fixtures/narrow_url_to_narrow_terms.json
+++ b/zerver/tests/fixtures/narrow_url_to_narrow_terms.json
@@ -134,6 +134,17 @@
}
]
},
+ {
+ "name": "mentions_link",
+ "near_link": "http://testserver/#narrow/mentions/35-Iago",
+ "expected_output": [
+ {
+ "operator": "mentions",
+ "operand": 35,
+ "negated": false
+ }
+ ]
+ },
{
"name": "legacy_channel_synonym",
"near_link": "http://testserver/#narrow/stream/13-Denmark",