Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Fix type issue with FormatJS rich text elements.
Anders Kaseorg3a718d786f40
diff --git a/docs/translating/internationalization.md b/docs/translating/internationalization.mdindex 3ba55e73b2f..f647e6d8279 100644--- a/docs/translating/internationalization.md+++ b/docs/translating/internationalization.md@@ -247,7 +247,7 @@ locally to the translation:```js$t_html({defaultMessage: "<b>HTML</b> linking to the <z-link>login page</z-link>"},- {"z-link": (content_html) => `<a href="/login/">${content_html}</a>`},+ {"z-link": (content_html) => `<a href="/login/">${content_html.join("")}</a>`},)```diff --git a/frontend_tests/node_tests/i18n.js b/frontend_tests/node_tests/i18n.jsindex 11a48fed4f5..5f046b93951 100644--- a/frontend_tests/node_tests/i18n.js+++ b/frontend_tests/node_tests/i18n.js@@ -60,7 +60,7 @@ run_test("$tr", () => {},{stream_name: "l'abonnement",- "z-link": (content_html) => `<a href='#streams/all'>${content_html}</a>`,+ "z-link": (content_html) => `<a href='#streams/all'>${content_html.join("")}</a>`,},),"<p>Le canal <b>l'abonnement</b> n'existe pas.</p><p>Gérez vos abonnements <a href='#streams/all'>sur votre page canaux</a>.</p>",diff --git a/frontend_tests/zjsunit/i18n.js b/frontend_tests/zjsunit/i18n.jsindex 4746c0622fc..a8897762f54 100644--- a/frontend_tests/zjsunit/i18n.js+++ b/frontend_tests/zjsunit/i18n.js@@ -13,7 +13,7 @@ exports.intl = createIntl(["b", "code", "em", "i", "kbd", "p", "strong"].map((tag) => [tag,/* istanbul ignore next */- (content_html) => `<${tag}>${content_html}</${tag}>`,+ (content_html) => `<${tag}>${content_html.join("")}</${tag}>`,]),),},@@ -33,7 +33,7 @@ exports.$t = (descriptor, values) =>const default_html_elements = Object.fromEntries(["b", "code", "em", "i", "kbd", "p", "strong"].map((tag) => [tag,- (content_html) => `<${tag}>${content_html}</${tag}>`,+ (content_html) => `<${tag}>${content_html.join("")}</${tag}>`,]),);diff --git a/static/js/compose_validate.js b/static/js/compose_validate.jsindex 4c2da5b7e57..37c11f66332 100644--- a/static/js/compose_validate.js+++ b/static/js/compose_validate.js@@ -392,7 +392,8 @@ export function validation_error(error_type, stream_name) {},{stream_name,- "z-link": (content_html) => `<a href='#streams/all'>${content_html}</a>`,+ "z-link": (content_html) =>+ `<a href='#streams/all'>${content_html.join("")}</a>`,},);compose_error.show(response, $("#stream_message_recipient_stream"));diff --git a/static/js/i18n.ts b/static/js/i18n.tsindex eb2394918bc..b4c06b34a2d 100644--- a/static/js/i18n.ts+++ b/static/js/i18n.ts@@ -30,7 +30,7 @@ export const $t = intl.formatMessage.bind(intl);export const default_html_elements = Object.fromEntries(["b", "code", "em", "i", "kbd", "p", "strong"].map((tag) => [tag,- (content_html: string) => `<${tag}>${content_html}</${tag}>`,+ (content_html: string[]) => `<${tag}>${content_html.join("")}</${tag}>`,]),);diff --git a/static/js/info_overlay.js b/static/js/info_overlay.jsindex 979a973aeb3..1c59f256471 100644--- a/static/js/info_overlay.js+++ b/static/js/info_overlay.js@@ -141,7 +141,9 @@ def zulip():},{"z-link": (content_html) =>- `<a target="_blank" rel="noopener noreferrer" href="https://pygments.org/docs/lexers/">${content_html}</a>`,+ `<a target="_blank" rel="noopener noreferrer" href="https://pygments.org/docs/lexers/">${content_html.join(+ "",+ )}</a>`,},),},@@ -177,7 +179,9 @@ This text won't be visible until the user clicks.},{"z-link": (content_html) =>- `<a target="_blank" rel="noopener noreferrer" href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#wiki-tables">${content_html}</a>`,+ `<a target="_blank" rel="noopener noreferrer" href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#wiki-tables">${content_html.join(+ "",+ )}</a>`,},),},diff --git a/static/js/narrow_banner.js b/static/js/narrow_banner.jsindex d76e4b8a022..48c2f848192 100644--- a/static/js/narrow_banner.js+++ b/static/js/narrow_banner.js@@ -15,7 +15,8 @@ const SPECTATOR_STREAM_NARROW_BANNER = {defaultMessage: "This is not a <z-link>publicly accessible</z-link> conversation.",},{- "z-link": (content_html) => `<a href="/help/public-access-option">${content_html}</a>`,+ "z-link": (content_html) =>+ `<a href="/help/public-access-option">${content_html.join("")}</a>`,},),};@@ -74,7 +75,9 @@ function pick_empty_narrow_banner() {},{"z-link": (content_html) =>- `<a href="#" class="empty_feed_compose_stream">${content_html}</a>`,+ `<a href="#" class="empty_feed_compose_stream">${content_html.join(+ "",+ )}</a>`,},),};@@ -162,7 +165,7 @@ function pick_empty_narrow_banner() {},{"z-link": (content_html) =>- `<a href="/help/star-a-message">${content_html}</a>`,+ `<a href="/help/star-a-message">${content_html.join("")}</a>`,},),};@@ -175,7 +178,9 @@ function pick_empty_narrow_banner() {},{"z-link": (content_html) =>- `<a href="/help/mention-a-user-or-group">${content_html}</a>`,+ `<a href="/help/mention-a-user-or-group">${content_html.join(+ "",+ )}</a>`,},),};@@ -191,7 +196,9 @@ function pick_empty_narrow_banner() {// TODO: The href here is a bit weird; we probably want to migrate// this to a button element down the line."z-link": (content_html) =>- `<a href="#" class="empty_feed_compose_private">${content_html}</a>`,+ `<a href="#" class="empty_feed_compose_private">${content_html.join(+ "",+ )}</a>`,},),};@@ -241,7 +248,9 @@ function pick_empty_narrow_banner() {},{"z-button": (content_html) =>- `<button class="button white rounded stream_sub_unsub_button sea-green" type="button" name="subscription">${content_html}</button>`,+ `<button class="button white rounded stream_sub_unsub_button sea-green" type="button" name="subscription">${content_html.join(+ "",+ )}</button>`,},),};@@ -286,7 +295,9 @@ function pick_empty_narrow_banner() {},{"z-link": (content_html) =>- `<a href="#" class="empty_feed_compose_private">${content_html}</a>`,+ `<a href="#" class="empty_feed_compose_private">${content_html.join(+ "",+ )}</a>`,},),};@@ -301,7 +312,9 @@ function pick_empty_narrow_banner() {},{"z-link": (content_html) =>- `<a href="#" class="empty_feed_compose_private">${content_html}</a>`,+ `<a href="#" class="empty_feed_compose_private">${content_html.join(+ "",+ )}</a>`,},),};@@ -314,7 +327,9 @@ function pick_empty_narrow_banner() {},{"z-link": (content_html) =>- `<a href="#" class="empty_feed_compose_private">${content_html}</a>`,+ `<a href="#" class="empty_feed_compose_private">${content_html.join(+ "",+ )}</a>`,},),};@@ -341,7 +356,9 @@ function pick_empty_narrow_banner() {},{"z-link": (content_html) =>- `<a href="#" class="empty_feed_compose_private">${content_html}</a>`,+ `<a href="#" class="empty_feed_compose_private">${content_html.join(+ "",+ )}</a>`,},),};diff --git a/static/js/read_receipts.js b/static/js/read_receipts.jsindex 454d5c5486c..6a26a36439f 100644--- a/static/js/read_receipts.js+++ b/static/js/read_receipts.js@@ -57,7 +57,9 @@ export function show_user_list(message_id) {{num_of_people: users.length,"z-link": (content_html) =>- `<a href="/help/read-receipts">${content_html}</a>`,+ `<a href="/help/read-receipts">${content_html.join(+ "",+ )}</a>`,},),);diff --git a/static/js/settings_account.js b/static/js/settings_account.jsindex e83a1dfb3f8..89292bc2d34 100644--- a/static/js/settings_account.js+++ b/static/js/settings_account.js@@ -714,7 +714,9 @@ export function set_up() {},{"z-link": (content_html) =>- `<a target="_blank" href="/#organization/organization-profile">${content_html}</a>`,+ `<a target="_blank" href="/#organization/organization-profile">${content_html.join(+ "",+ )}</a>`,},);let rendered_error_msg;diff --git a/static/js/settings_display.js b/static/js/settings_display.jsindex 37131c7d5fa..3c0239f9cab 100644--- a/static/js/settings_display.js+++ b/static/js/settings_display.js@@ -104,7 +104,10 @@ function user_default_language_modal_post_render() {defaultMessage:"Saved. Please <z-link>reload</z-link> for the change to take effect.",},- {"z-link": (content_html) => `<a class='reload_link'>${content_html}</a>`},+ {+ "z-link": (content_html) =>+ `<a class='reload_link'>${content_html.join("")}</a>`,+ },),true,);@@ -196,7 +199,10 @@ export function set_up(settings_panel) {defaultMessage:"Saved. Please <z-link>reload</z-link> for the change to take effect.",},- {"z-link": (content_html) => `<a class='reload_link'>${content_html}</a>`},+ {+ "z-link": (content_html) =>+ `<a class='reload_link'>${content_html.join("")}</a>`,+ },),true,);