Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
rendered_markdown: Initialize message only when needed.
Amit Patilf573daa6e37f
diff --git a/web/src/rendered_markdown.ts b/web/src/rendered_markdown.tsindex 5d0d4b90d1e..ccd30da4017 100644--- a/web/src/rendered_markdown.ts+++ b/web/src/rendered_markdown.ts@@ -157,6 +157,7 @@ export function set_name_in_mention_element(}export const update_elements = ($content: JQuery): void => {+ let message: Message | undefined;// Set the rtl class if the text has an rtl directionif (rtl.get_direction($content.text()) === "rtl") {$content.addClass("rtl");@@ -182,7 +183,7 @@ export const update_elements = ($content: JQuery): void => {// personal and stream wildcard mentions$content.find(".user-mention").each(function (): void {const user_id = get_user_id_for_mention_button(this);- const message = get_message_for_message_content($content);+ message ??= get_message_for_message_content($content);const user_is_bot =user_id !== undefined && user_id !== "*" && people.is_valid_bot_user(user_id);// We give special highlights to the mention buttons@@ -223,7 +224,7 @@ export const update_elements = ($content: JQuery): void => {});$content.find(".topic-mention").each(function (): void {- const message = get_message_for_message_content($content);+ message ??= get_message_for_message_content($content);if (message?.topic_wildcard_mentioned) {$(this).addClass("user-mention-me");