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.

markdown: Fix a bug in query_and_reply.

100RABHpy039dd256a146
diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js
index 82d0296b03c..0d0af86b319 100644
--- a/frontend_tests/node_tests/popovers.js
+++ b/frontend_tests/node_tests/popovers.js
@@ -243,7 +243,7 @@ test_ui("actions_popover", (override) => {
case "actions_popover_content":
assert.equal(
opts.conversation_time_uri,
- "http://chat.zulip.org/#narrow/stream/Bracket.20%28.20stream/topic/Actions.20%281%29/near/999",
+ "http://chat.zulip.org/#narrow/stream/Bracket.20.28.20stream/topic/Actions.20.281.29/near/999",
);
return "actions-content";
default:
diff --git a/static/js/hash_util.js b/static/js/hash_util.js
index 30423c70650..84d595c57da 100644
--- a/static/js/hash_util.js
+++ b/static/js/hash_util.js
@@ -26,7 +26,14 @@ export function get_hash_section(hash) {
// window.location.hash. So we hide our URI-encoding
// by replacing % with . (like MediaWiki).
export function encodeHashComponent(str) {
- return encodeURIComponent(str).replace(/\./g, "%2E").replace(/%/g, ".");
+ const characterToBeReplaced = {
+ "%": ".",
+ "(": ".28",
+ ")": ".29",
+ };
+ return encodeURIComponent(str)
+ .replace(/\./g, "%2E")
+ .replace(/[%()]/g, (matched) => characterToBeReplaced[matched]);
}
export function encode_operand(operator, operand) {
diff --git a/static/js/popovers.js b/static/js/popovers.js
index a92706fbbf8..c290f62f206 100644
--- a/static/js/popovers.js
+++ b/static/js/popovers.js
@@ -560,10 +560,7 @@ export function toggle_actions_popover(element, id) {
editability === message_edit.editability_types.TOPIC_ONLY;
const should_display_quote_and_reply = message.content !== "<p>(deleted)</p>";
- const conversation_time_uri = hash_util
- .by_conversation_and_time_uri(message)
- .replace(/\(/g, "%28")
- .replace(/\)/g, "%29");
+ const conversation_time_uri = hash_util.by_conversation_and_time_uri(message);
const should_display_delete_option = message_edit.get_deletability(message);
const args = {