Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
quote: Extract generate_channel_message_quote_context.
apoorvapendseddf829ad8230
diff --git a/web/src/compose_reply.ts b/web/src/compose_reply.tsindex 8c6e954bfc3..145cffb5802 100644--- a/web/src/compose_reply.ts+++ b/web/src/compose_reply.ts@@ -338,6 +338,39 @@ function generate_sender_only_quote_context(message: Message): string {);}+function generate_channel_message_quote_context(message: Message): string {+ assert(message.type === "stream");+ const sender_mention = generate_sender_mention(message);+ const link = internal_url.by_stream_topic_url(+ message.stream_id,+ message.topic,+ sub_store.maybe_get_stream_name,+ message.id,+ );+ const channel_name = sub_store.maybe_get_stream_name(message.stream_id)!;+ const topic_link_syntax = topic_link_util.get_stream_topic_link_syntax(+ channel_name,+ message.topic,+ true,+ );+ // Final message looks like:+ // @_**Iago|5** [said](link to message) in [#channel > topic](link to topic):+ // ```quote+ // message content+ // ```+ // Keep syntax in sync with channel message reminder format in zerver/lib/reminders.py+ return $t(+ {+ defaultMessage: "{username} [said]({link_to_message}) in {topic_link_syntax}:",+ },+ {+ username: sender_mention,+ link_to_message: hash_util.by_conversation_and_time_url(message),+ topic_link_syntax: topic_link_util.as_markdown_link_syntax(topic_link_syntax, link),+ },+ );+}+function generate_replace_content(info: ReplaceContentOpts): string {const {message, raw_content, forward_message} = info;let content;@@ -346,34 +379,7 @@ function generate_replace_content(info: ReplaceContentOpts): string {if (!forward_message) {content = generate_sender_only_quote_context(message);} else if (message.type === "stream") {- const link = internal_url.by_stream_topic_url(- message.stream_id,- message.topic,- sub_store.maybe_get_stream_name,- message.id,- );- const channel_name = sub_store.maybe_get_stream_name(message.stream_id)!;- const topic_link_syntax = topic_link_util.get_stream_topic_link_syntax(- channel_name,- message.topic,- true,- );- // Final message looks like:- // @_**Iago|5** [said](link to message) in [#channel > topic](link to topic):- // ```quote- // message content- // ```- // Keep syntax in sync with channel message reminder format in zerver/lib/reminders.py- content = $t(- {- defaultMessage: "{username} [said]({link_to_message}) in {topic_link_syntax}:",- },- {- username: sender_mention,- link_to_message: hash_util.by_conversation_and_time_url(message),- topic_link_syntax: topic_link_util.as_markdown_link_syntax(topic_link_syntax, link),- },- );+ content = generate_channel_message_quote_context(message);} else {const dm_user_ids = people.all_user_ids_in_pm(message)!;const recipient_user_ids =