Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
topic_link_util: Use module to generate correct links.
Kislay Verma316d1cf285e5
diff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.pyindex b1d5bde2a80..2743a9e3952 100644--- a/zerver/actions/message_edit.py+++ b/zerver/actions/message_edit.py@@ -72,6 +72,7 @@ from zerver.lib.topic import (update_edit_history,update_messages_for_topic_edit,)+from zerver.lib.topic_link_util import get_stream_topic_link_syntaxfrom zerver.lib.types import DirectMessageEditRequest, EditHistoryEvent, StreamMessageEditRequestfrom zerver.lib.url_encoding import near_stream_message_urlfrom zerver.lib.user_message import bulk_insert_all_ums@@ -286,8 +287,8 @@ def send_message_moved_breadcrumbs(old_topic_name = message_edit_request.orig_topic_namenew_stream = message_edit_request.target_streamnew_topic_name = message_edit_request.target_topic_name- old_topic_link = f"#**{old_stream.name}>{old_topic_name}**"- new_topic_link = f"#**{new_stream.name}>{new_topic_name}**"+ old_topic_link = get_stream_topic_link_syntax(old_stream.id, old_stream.name, old_topic_name)+ new_topic_link = get_stream_topic_link_syntax(new_stream.id, new_stream.name, new_topic_name)message = {"id": target_message.id,"stream_id": new_stream.id,diff --git a/zerver/actions/message_send.py b/zerver/actions/message_send.pyindex acd8347dbc6..a1b32358b5f 100644--- a/zerver/actions/message_send.py+++ b/zerver/actions/message_send.py@@ -75,6 +75,7 @@ from zerver.lib.string_validation import check_stream_namefrom zerver.lib.thumbnail import get_user_upload_previews, rewrite_thumbnailed_imagesfrom zerver.lib.timestamp import timestamp_to_datetimefrom zerver.lib.topic import participants_for_topic+from zerver.lib.topic_link_util import get_stream_link_syntaxfrom zerver.lib.url_preview.types import UrlEmbedDatafrom zerver.lib.user_groups import (check_any_user_has_permission_by_role,@@ -1536,7 +1537,7 @@ def send_pm_if_empty_stream(returnarg_dict = {**arg_dict,- "channel_name": f"#**{stream.name}**",+ "channel_name": f"{get_stream_link_syntax(stream.id, stream.name)}",}content = _("Your bot {bot_identity} tried to send a message to "diff --git a/zerver/views/streams.py b/zerver/views/streams.pyindex 8b6e81d065e..dc6445beb9a 100644--- a/zerver/views/streams.py+++ b/zerver/views/streams.py@@ -84,6 +84,7 @@ from zerver.lib.topic import (maybe_rename_general_chat_to_empty_topic,messages_for_topic,)+from zerver.lib.topic_link_util import get_stream_link_syntaxfrom zerver.lib.typed_endpoint import ApiParamConfig, PathOnly, typed_endpointfrom zerver.lib.typed_endpoint_validators import check_colorfrom zerver.lib.types import UserGroupMembersData@@ -855,7 +856,9 @@ def send_messages_for_new_subscribers(content = content.format(user_name=silent_mention_syntax_for_user(user_profile),- new_channels=", ".join(f"#**{s.name}**" for s in created_streams),+ new_channels=", ".join(+ f"{get_stream_link_syntax(s.id, s.name)}" for s in created_streams+ ),)sender = get_system_bot(