Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
push_notifications: Use is_same_server_message_link lib function.
Prakhar Pratyush55a8bdfbd9eb
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.pyindex 8113e7d5f6f..f1db4d5e50b 100644--- a/zerver/lib/push_notifications.py+++ b/zerver/lib/push_notifications.py@@ -54,6 +54,7 @@ from zerver.lib.remote_server import (from zerver.lib.soft_deactivation import soft_reactivate_if_personal_notificationfrom zerver.lib.tex import change_katex_to_raw_latexfrom zerver.lib.timestamp import datetime_to_timestamp+from zerver.lib.url_decoding import is_same_server_message_linkfrom zerver.lib.users import check_can_access_userfrom zerver.models import (AbstractPushDeviceToken,@@ -922,20 +923,6 @@ def get_mobile_push_content(rendered_content: str) -> str:plain_text += elem.tail or ""return plain_text- def is_same_server_message_link(hash: str) -> bool:- # A same server message link always has category `narrow`,- # section `stream` or `dm`, and ends with `/near/<message_id>`,- # where <message_id> is a sequence of digits.- match = re.match(r"#([^/]+)", hash)- if match is None or match.group(1) != "narrow":- return False-- match = re.search(r"#narrow/([^/]+)", hash)- if match is None or not (match.group(1) == "stream" or match.group(1) == "dm"):- return False-- return re.search(r"/near/\d+$", hash) is not None-def is_user_said_paragraph(element: lxml.html.HtmlElement) -> bool:# The user said paragraph has these exact elements:# 1. A user mention