Skip to content

A platform for community discussion. Free, open, simple.

DEV: Rename htmlSafe to trustHTML from @ember/template (#38465)

Sérgio Saquetim5dcc2cd0c7bb
diff --git a/frontend/discourse/admin/components/admin-badges-show.gjs b/frontend/discourse/admin/components/admin-badges-show.gjs
index bd0bdc59a77..acd397c91a2 100644
--- a/frontend/discourse/admin/components/admin-badges-show.gjs
+++ b/frontend/discourse/admin/components/admin-badges-show.gjs
@@ -4,7 +4,7 @@ import { concat, fn, hash } from "@ember/helper";
import { action, getProperties } from "@ember/object";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminBadgesList from "discourse/admin/components/admin-badges-list";
import BadgePreviewModal from "discourse/admin/components/modal/badge-preview";
import Form from "discourse/components/form";
@@ -81,7 +81,7 @@ export default class AdminBadgesShow extends Component {
}
sanitizeDescription(text) {
- return htmlSafe(sanitize(text));
+ return trustHTML(sanitize(text));
}
hasQuery(query) {
diff --git a/frontend/discourse/admin/components/admin-config-area-empty-list.gjs b/frontend/discourse/admin/components/admin-config-area-empty-list.gjs
index f6bd0d6c761..8549bc4c61c 100644
--- a/frontend/discourse/admin/components/admin-config-area-empty-list.gjs
+++ b/frontend/discourse/admin/components/admin-config-area-empty-list.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import concatClass from "discourse/helpers/concat-class";
import { i18n } from "discourse-i18n";
@@ -15,7 +15,7 @@ export default class AdminConfigAreaEmptyList extends Component {
<template>
<div class="admin-config-area-empty-list">
- {{htmlSafe this.emptyLabel}}
+ {{trustHTML this.emptyLabel}}
{{#if @ctaLabel}}
<DButton
diff --git a/frontend/discourse/admin/components/admin-config-areas/upcoming-change-item.gjs b/frontend/discourse/admin/components/admin-config-areas/upcoming-change-item.gjs
index 6352f284aa6..752a05ef672 100644
--- a/frontend/discourse/admin/components/admin-config-areas/upcoming-change-item.gjs
+++ b/frontend/discourse/admin/components/admin-config-areas/upcoming-change-item.gjs
@@ -8,7 +8,7 @@ import { LinkTo } from "@ember/routing";
import { cancel } from "@ember/runloop";
import { service } from "@ember/service";
import { capitalize } from "@ember/string";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import DButton from "discourse/components/d-button";
import DSelect from "discourse/components/d-select";
@@ -314,7 +314,7 @@ export default class UpcomingChangeItem extends Component {
{{#if @change.upcoming_change.learn_more_url}}
<span class="upcoming-change__learn-more">
- {{htmlSafe
+ {{trustHTML
(i18n
"feedback_with_link"
[email protected]_change.learn_more_url
diff --git a/frontend/discourse/admin/components/admin-flag-item.gjs b/frontend/discourse/admin/components/admin-flag-item.gjs
index bf608d22fc4..ab8e9ab98a4 100644
--- a/frontend/discourse/admin/components/admin-flag-item.gjs
+++ b/frontend/discourse/admin/components/admin-flag-item.gjs
@@ -6,7 +6,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { SYSTEM_FLAG_IDS } from "discourse/admin/lib/constants";
import DButton from "discourse/components/d-button";
import DToggleSwitch from "discourse/components/d-toggle-switch";
@@ -138,7 +138,7 @@ export default class AdminFlagItem extends Component {
<div
class="d-table__overview-name admin-flag-item__name"
>{{@flag.name}}</div>
- <div class="d-table__overview-about">{{htmlSafe
+ <div class="d-table__overview-about">{{trustHTML
@flag.description
}}</div>
</LinkTo>
@@ -146,7 +146,7 @@ export default class AdminFlagItem extends Component {
<div
class="d-table__overview-name admin-flag-item__name"
>{{@flag.name}}</div>
- <div class="d-table__overview-about">{{htmlSafe
+ <div class="d-table__overview-about">{{trustHTML
@flag.description
}}</div>
{{/if}}
diff --git a/frontend/discourse/admin/components/admin-notice.gjs b/frontend/discourse/admin/components/admin-notice.gjs
index 9389adc36b8..7a9bf4a5cd0 100644
--- a/frontend/discourse/admin/components/admin-notice.gjs
+++ b/frontend/discourse/admin/components/admin-notice.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import icon from "discourse/helpers/d-icon";
@@ -21,7 +21,7 @@ export default class AdminNotice extends Component {
<div class="notice">
<div class="message">
{{if @icon (icon @icon)}}
- {{htmlSafe @problem.message}}
+ {{trustHTML @problem.message}}
</div>
{{#if this.canDismiss}}
<DButton
diff --git a/frontend/discourse/admin/components/admin-penalty-post-action.gjs b/frontend/discourse/admin/components/admin-penalty-post-action.gjs
index f4859f8321d..ee757f0f792 100644
--- a/frontend/discourse/admin/components/admin-penalty-post-action.gjs
+++ b/frontend/discourse/admin/components/admin-penalty-post-action.gjs
@@ -4,7 +4,7 @@ import Component, { Input, Textarea } from "@ember/component";
import { on } from "@ember/modifier";
import { action, computed } from "@ember/object";
import { equal } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { afterRender } from "discourse/lib/decorators";
import ComboBox from "discourse/select-kit/components/combo-box";
import I18n, { i18n } from "discourse-i18n";
@@ -92,7 +92,7 @@ export default class AdminPenaltyPostAction extends Component {
<div class="penalty-post-controls">
<label>
<div class="penalty-post-label">
- {{htmlSafe (i18n "admin.user.penalty_post_actions")}}
+ {{trustHTML (i18n "admin.user.penalty_post_actions")}}
</div>
</label>
<ComboBox
@@ -115,7 +115,7 @@ export default class AdminPenaltyPostAction extends Component {
@checked={{this.confirmDeleteAll}}
{{on "click" this.toggleConfirmDeleteAll}}
/>
- {{htmlSafe this.deleteAllMessage}}
+ {{trustHTML this.deleteAllMessage}}
</label>
{{/if}}
</template>
diff --git a/frontend/discourse/admin/components/admin-penalty-reason.gjs b/frontend/discourse/admin/components/admin-penalty-reason.gjs
index e8aa223a23c..32acdf062bc 100644
--- a/frontend/discourse/admin/components/admin-penalty-reason.gjs
+++ b/frontend/discourse/admin/components/admin-penalty-reason.gjs
@@ -2,7 +2,7 @@
import Component, { Textarea } from "@ember/component";
import { action, computed } from "@ember/object";
import { equal } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import TextField from "discourse/components/text-field";
import ComboBox from "discourse/select-kit/components/combo-box";
@@ -79,7 +79,7 @@ export default class AdminPenaltyReason extends Component {
{{/if}}
{{else if (eq @penaltyType "silence")}}
<label class="silence-reason-title">
- {{htmlSafe (i18n "admin.user.silence_reason_label")}}</label>
+ {{trustHTML (i18n "admin.user.silence_reason_label")}}</label>
<ComboBox
@content={{this.reasons}}
diff --git a/frontend/discourse/admin/components/admin-penalty-similar-users.gjs b/frontend/discourse/admin/components/admin-penalty-similar-users.gjs
index 3bcf51bbd0a..a9eeea657ef 100644
--- a/frontend/discourse/admin/components/admin-penalty-similar-users.gjs
+++ b/frontend/discourse/admin/components/admin-penalty-similar-users.gjs
@@ -4,7 +4,7 @@ import { Input } from "@ember/component";
import { fn, get, hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import avatar from "discourse/helpers/avatar";
import formatDuration from "discourse/helpers/format-duration";
@@ -59,7 +59,7 @@ export default class AdminPenaltySimilarUsers extends Component {
<template>
<div class="penalty-similar-users">
<p class="alert alert-warning">
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.user.other_matches"
diff --git a/frontend/discourse/admin/components/admin-report-storage-stats.gjs b/frontend/discourse/admin/components/admin-report-storage-stats.gjs
index 65693406329..bd26dd5c39e 100644
--- a/frontend/discourse/admin/components/admin-report-storage-stats.gjs
+++ b/frontend/discourse/admin/components/admin-report-storage-stats.gjs
@@ -2,7 +2,7 @@
import Component from "@ember/component";
import { computed } from "@ember/object";
import { alias } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import icon from "discourse/helpers/d-icon";
import formatDate from "discourse/helpers/format-date";
@@ -79,7 +79,7 @@ export default class AdminReportStorageStats extends Component {
{{#if this.backupStats.last_backup_taken_at}}
<br />
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.dashboard.lastest_backup"
date=(formatDate
diff --git a/frontend/discourse/admin/components/admin-report-table-cell.gjs b/frontend/discourse/admin/components/admin-report-table-cell.gjs
index be429b5e1a6..9aa46a8aecf 100644
--- a/frontend/discourse/admin/components/admin-report-table-cell.gjs
+++ b/frontend/discourse/admin/components/admin-report-table-cell.gjs
@@ -2,7 +2,7 @@
import Component from "@ember/component";
import { computed } from "@ember/object";
import { alias } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import concatClass from "discourse/helpers/concat-class";
@@ -26,7 +26,7 @@ export default class AdminReportTableCell extends Component {
class={{concatClass "admin-report-table-cell" this.type this.property}}
...attributes
>
- {{htmlSafe this.formattedValue}}
+ {{trustHTML this.formattedValue}}
</td>
</template>
}
diff --git a/frontend/discourse/admin/components/admin-report-table-header.gjs b/frontend/discourse/admin/components/admin-report-table-header.gjs
index f4386a542b8..47a53e13d4e 100644
--- a/frontend/discourse/admin/components/admin-report-table-header.gjs
+++ b/frontend/discourse/admin/components/admin-report-table-header.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import { i18n } from "discourse-i18n";
@@ -52,11 +52,11 @@ export default class AdminReportTableHeader extends Component {
class="btn-transparent --primary sort-btn"
>
{{#if @label.htmlTitle}}
- <span class="d-button-label">{{htmlSafe @label.htmlTitle}}</span>
+ <span class="d-button-label">{{trustHTML @label.htmlTitle}}</span>
{{/if}}
</DButton>
{{else if @label.htmlTitle}}
- <span class="title">{{htmlSafe @label.htmlTitle}}</span>
+ <span class="title">{{trustHTML @label.htmlTitle}}</span>
{{else}}
<span class="title">{{@label.title}}</span>
{{/if}}
diff --git a/frontend/discourse/admin/components/admin-search.gjs b/frontend/discourse/admin/components/admin-search.gjs
index c14f1c61eb1..a5964a5194a 100644
--- a/frontend/discourse/admin/components/admin-search.gjs
+++ b/frontend/discourse/admin/components/admin-search.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import icon from "discourse/helpers/d-icon";
import discourseDebounce from "discourse/lib/debounce";
@@ -193,7 +193,7 @@ export default class AdminSearch extends Component {
>{{result.label}}</span>
</div>
{{#if result.description}}
- <div class="admin-search__result-description">{{htmlSafe
+ <div class="admin-search__result-description">{{trustHTML
result.description
}}</div>
{{/if}}
diff --git a/frontend/discourse/admin/components/admin-theme-editor.gjs b/frontend/discourse/admin/components/admin-theme-editor.gjs
index fe1834ceaab..fa889db9c97 100644
--- a/frontend/discourse/admin/components/admin-theme-editor.gjs
+++ b/frontend/discourse/admin/components/admin-theme-editor.gjs
@@ -7,7 +7,7 @@ import { action, computed } from "@ember/object";
import { LinkTo } from "@ember/routing";
import { next } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import AceEditor from "discourse/components/ace-editor";
import icon from "discourse/helpers/d-icon";
@@ -239,7 +239,7 @@ export default class AdminThemeEditor extends Component {
{{/if}}
{{#if this.warning}}
- <pre class="field-warning">{{htmlSafe this.warning}}</pre>
+ <pre class="field-warning">{{trustHTML this.warning}}</pre>
{{/if}}
<div class="field-info">
diff --git a/frontend/discourse/admin/components/admin-user-field-item.gjs b/frontend/discourse/admin/components/admin-user-field-item.gjs
index a547de2ac5e..b8f86bc1935 100644
--- a/frontend/discourse/admin/components/admin-user-field-item.gjs
+++ b/frontend/discourse/admin/components/admin-user-field-item.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { action } from "@ember/object";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { USER_FIELD_FLAGS } from "discourse/admin/lib/constants";
import UserField from "discourse/admin/models/user-field";
import DButton from "discourse/components/d-button";
@@ -75,7 +75,7 @@ export default class AdminUserFieldItem extends Component {
<div class="d-table__overview-name admin-user_field-item__name">
{{@userField.name}}
</div>
- <div class="d-table__overview-about">{{htmlSafe
+ <div class="d-table__overview-about">{{trustHTML
@userField.description
}}</div>
</LinkTo>
diff --git a/frontend/discourse/admin/components/admin-user-upcoming-changes.gjs b/frontend/discourse/admin/components/admin-user-upcoming-changes.gjs
index 34e45345ff0..6acddfbf611 100644
--- a/frontend/discourse/admin/components/admin-user-upcoming-changes.gjs
+++ b/frontend/discourse/admin/components/admin-user-upcoming-changes.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { array } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminFilterControls from "discourse/admin/components/admin-filter-controls";
import { UPCOMING_CHANGES_USER_ENABLED_REASONS } from "discourse/lib/constants";
import { bind } from "discourse/lib/decorators";
@@ -94,7 +94,7 @@ export default class AdminUserUpcomingChanges extends Component {
)
}}
<span class="upcoming-change-groups">
- {{htmlSafe
+ {{trustHTML
(this.getGroupLinks upcomingChange.specific_groups)
}}
</span>
diff --git a/frontend/discourse/admin/components/admin-welcome-banner-form.gjs b/frontend/discourse/admin/components/admin-welcome-banner-form.gjs
index c26695f5d14..685154c458b 100644
--- a/frontend/discourse/admin/components/admin-welcome-banner-form.gjs
+++ b/frontend/discourse/admin/components/admin-welcome-banner-form.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { fn, hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DMultiSelect from "discourse/components/d-multi-select";
import Form from "discourse/components/form";
@@ -488,7 +488,7 @@ export default class AdminWelcomeBannerForm extends Component {
@title={{i18n
"admin.config.welcome_banner.form.header_new_members.label"
}}
- @description={{htmlSafe
+ @description={{trustHTML
(i18n
"admin.config.welcome_banner.form.header_new_members.description"
)
@@ -512,7 +512,7 @@ export default class AdminWelcomeBannerForm extends Component {
@title={{i18n
"admin.config.welcome_banner.form.header_logged_in.label"
}}
- @description={{htmlSafe
+ @description={{trustHTML
(i18n
"admin.config.welcome_banner.form.header_logged_in.description"
)
@@ -536,7 +536,7 @@ export default class AdminWelcomeBannerForm extends Component {
@title={{i18n
"admin.config.welcome_banner.form.header_anonymous.label"
}}
- @description={{htmlSafe
+ @description={{trustHTML
(i18n
"admin.config.welcome_banner.form.header_anonymous.description"
)
diff --git a/frontend/discourse/admin/components/changes-banner.gjs b/frontend/discourse/admin/components/changes-banner.gjs
index 8ae8a91cd38..486f9e8b259 100644
--- a/frontend/discourse/admin/components/changes-banner.gjs
+++ b/frontend/discourse/admin/components/changes-banner.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import DButton from "discourse/components/d-button";
@@ -38,7 +38,7 @@ export default class ChangesBanner extends Component {
<template>
<div class="admin-changes-banner" {{this.resizerModifier}}>
- <span class="admin-changes-banner__main-label">{{htmlSafe
+ <span class="admin-changes-banner__main-label">{{trustHTML
@bannerLabel
}}</span>
<div class="controls">
diff --git a/frontend/discourse/admin/components/edit-category-general.gjs b/frontend/discourse/admin/components/edit-category-general.gjs
index ad37c3f58a8..0e6c45d7146 100644
--- a/frontend/discourse/admin/components/edit-category-general.gjs
+++ b/frontend/discourse/admin/components/edit-category-general.gjs
@@ -3,7 +3,7 @@ import { cached } from "@glimmer/tracking";
import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DecoratedHtml from "discourse/components/decorated-html";
import PluginOutlet from "discourse/components/plugin-outlet";
import categoryBadge from "discourse/helpers/category-badge";
@@ -191,10 +191,10 @@ export default class EditCategoryGeneral extends Component {
get categoryDescription() {
if (this.args.category.description) {
- return htmlSafe(this.args.category.description);
+ return trustHTML(this.args.category.description);
}
- return htmlSafe(i18n("category.no_description"));
+ return trustHTML(i18n("category.no_description"));
}
get canSelectParentCategory() {
@@ -210,7 +210,7 @@ export default class EditCategoryGeneral extends Component {
<div class={{this.panelClass}}>
{{#if this.showWarning}}
<@form.Alert @type="warning" @icon="triangle-exclamation">
- {{htmlSafe
+ {{trustHTML
(i18n
"category.uncategorized_general_warning"
settingLink=this.uncategorizedSiteSettingLink
@@ -314,7 +314,7 @@ export default class EditCategoryGeneral extends Component {
@validation="required"
as |field|
>
- {{htmlSafe (this.categoryBadgePreview @transientData)}}
+ {{trustHTML (this.categoryBadgePreview @transientData)}}
<field.Select as |select|>
{{#each this.styleTypes as |styleType|}}
<select.Option @value={{styleType.id}}>
diff --git a/frontend/discourse/admin/components/edit-category-settings.gjs b/frontend/discourse/admin/components/edit-category-settings.gjs
index 71fee90a9ed..981309116bb 100644
--- a/frontend/discourse/admin/components/edit-category-settings.gjs
+++ b/frontend/discourse/admin/components/edit-category-settings.gjs
@@ -3,7 +3,7 @@ import { fn, hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { action, computed } from "@ember/object";
import { and, empty } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { buildCategoryPanel } from "discourse/admin/components/edit-category-panel";
import PluginOutlet from "discourse/components/plugin-outlet";
import RelativeTimePicker from "discourse/components/relative-time-picker";
@@ -201,7 +201,7 @@ export default class EditCategorySettings extends buildCategoryPanel(
{{#unless this.showPositionInput}}
<section class="field position-disabled">
- {{htmlSafe
+ {{trustHTML
(i18n
"category.position_disabled"
url=(getUrl
@@ -578,7 +578,7 @@ export default class EditCategorySettings extends buildCategoryPanel(
{{#unless this.emailInEnabled}}
<section class="field email-in-disabled">
- {{htmlSafe
+ {{trustHTML
(i18n
"category.email_in_disabled"
setting_url=(getUrl
diff --git a/frontend/discourse/admin/components/ip-lookup.gjs b/frontend/discourse/admin/components/ip-lookup.gjs
index 1ddc14552a9..7682ff65081 100644
--- a/frontend/discourse/admin/components/ip-lookup.gjs
+++ b/frontend/discourse/admin/components/ip-lookup.gjs
@@ -3,7 +3,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import IpLookupAccountsTable from "discourse/admin/components/ip-lookup-accounts-table";
import AdminUser from "discourse/admin/models/admin-user";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
@@ -245,7 +245,7 @@ export default class IpLookup extends Component {
{{/if}}
</ConditionalLoadingSpinner>
</dl>
- <div class="powered-by">{{htmlSafe
+ <div class="powered-by">{{trustHTML
(i18n "ip_lookup.powered_by")
}}</div>
</div>
diff --git a/frontend/discourse/admin/components/modal/badge-preview.gjs b/frontend/discourse/admin/components/modal/badge-preview.gjs
index d711e518146..553857e1d57 100644
--- a/frontend/discourse/admin/components/modal/badge-preview.gjs
+++ b/frontend/discourse/admin/components/modal/badge-preview.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DModal from "discourse/components/d-modal";
import icon from "discourse/helpers/d-icon";
import { escapeExpression } from "discourse/lib/utilities";
@@ -69,14 +69,14 @@ export default class BadgePreview extends Component {
{{else}}
<p class="grant-count">
{{#if @model.badge.grant_count}}
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.badges.preview.grant_count"
)
}}
{{else}}
- {{htmlSafe (i18n "admin.badges.preview.no_grant_count")}}
+ {{trustHTML (i18n "admin.badges.preview.no_grant_count")}}
{{/if}}
</p>
@@ -98,14 +98,14 @@ export default class BadgePreview extends Component {
</p>
<ul>
{{#each this.processedSample as |html|}}
- <li>{{htmlSafe html}}</li>
+ <li>{{trustHTML html}}</li>
{{/each}}
</ul>
{{/if}}
{{#if this.hasQueryPlan}}
<div class="badge-query-plan">
- {{htmlSafe this.queryPlanHtml}}
+ {{trustHTML this.queryPlanHtml}}
</div>
{{/if}}
{{/if}}
diff --git a/frontend/discourse/admin/components/modal/delete-posts-confirmation.gjs b/frontend/discourse/admin/components/modal/delete-posts-confirmation.gjs
index e5ceb034e10..6bedc226b76 100644
--- a/frontend/discourse/admin/components/modal/delete-posts-confirmation.gjs
+++ b/frontend/discourse/admin/components/modal/delete-posts-confirmation.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { Input } from "@ember/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n";
@@ -22,7 +22,7 @@ export default class DeletePostsConfirmation extends Component {
<template>
<DModal
- @title={{htmlSafe
+ @title={{trustHTML
(i18n
"admin.user.delete_posts.confirmation.title"
@@ -31,7 +31,7 @@ export default class DeletePostsConfirmation extends Component {
@closeModal={{@closeModal}}
>
<:body>
- <p>{{htmlSafe
+ <p>{{trustHTML
(i18n
"admin.user.delete_posts.confirmation.description"
diff --git a/frontend/discourse/admin/components/modal/delete-user-posts-progress.gjs b/frontend/discourse/admin/components/modal/delete-user-posts-progress.gjs
index 723e57ffa22..967de9fce11 100644
--- a/frontend/discourse/admin/components/modal/delete-user-posts-progress.gjs
+++ b/frontend/discourse/admin/components/modal/delete-user-posts-progress.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { concat } from "@ember/helper";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminUser from "discourse/admin/models/admin-user";
import DModal from "discourse/components/d-modal";
import { extractError } from "discourse/lib/ajax-error";
@@ -64,10 +64,10 @@ export default class DeleteUserPostsProgress extends Component {
@dismissable={{false}}
>
<:body>
- <p>{{htmlSafe this.deletedDescription}}</p>
+ <p>{{trustHTML this.deletedDescription}}</p>
<div class="progress-bar">
<span
- style={{htmlSafe (concat "width: " this.deletedPercentage "%")}}
+ style={{trustHTML (concat "width: " this.deletedPercentage "%")}}
/>
</div>
</:body>
diff --git a/frontend/discourse/admin/components/modal/install-theme.gjs b/frontend/discourse/admin/components/modal/install-theme.gjs
index 8fe89df7aa0..be24351d3e3 100644
--- a/frontend/discourse/admin/components/modal/install-theme.gjs
+++ b/frontend/discourse/admin/components/modal/install-theme.gjs
@@ -6,7 +6,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import InstallThemeItem from "discourse/admin/components/install-theme-item";
import { COMPONENTS, THEMES } from "discourse/admin/models/theme";
import ConditionalLoadingSection from "discourse/components/conditional-loading-section";
@@ -463,7 +463,7 @@ export default class InstallThemeModal extends Component {
{{#if this.directRepoInstall}}
<div class="repo">
<div class="label">
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.customize.theme.direct_install_tip"
diff --git a/frontend/discourse/admin/components/modal/merge-users-confirmation.gjs b/frontend/discourse/admin/components/modal/merge-users-confirmation.gjs
index 345572c70e5..4b5e2b0f8a9 100644
--- a/frontend/discourse/admin/components/modal/merge-users-confirmation.gjs
+++ b/frontend/discourse/admin/components/modal/merge-users-confirmation.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { Input } from "@ember/component";
import { fn } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n";
@@ -23,14 +23,14 @@ export default class MergeUsersConfirmation extends Component {
<template>
<DModal
- @title={{htmlSafe
+ @title={{trustHTML
(i18n "admin.user.merge.confirmation.title" [email protected])
}}
@closeModal={{@closeModal}}
>
<:body>
<p>
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.user.merge.confirmation.description"
diff --git a/frontend/discourse/admin/components/modal/merge-users-prompt.gjs b/frontend/discourse/admin/components/modal/merge-users-prompt.gjs
index 777bfd979aa..389e4154e6f 100644
--- a/frontend/discourse/admin/components/modal/merge-users-prompt.gjs
+++ b/frontend/discourse/admin/components/modal/merge-users-prompt.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { fn, get, hash } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import EmailGroupUserChooser from "discourse/select-kit/components/email-group-user-chooser";
@@ -19,14 +19,14 @@ export default class MergeUsersPrompt extends Component {
<template>
<DModal
- @title={{htmlSafe
+ @title={{trustHTML
(i18n "admin.user.merge.prompt.title" [email protected])
}}
@closeModal={{@closeModal}}
>
<:body>
<p>
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.user.merge.prompt.description"
diff --git a/frontend/discourse/admin/components/modal/penalize-user.gjs b/frontend/discourse/admin/components/modal/penalize-user.gjs
index 1a6a537feda..04f6b19dc91 100644
--- a/frontend/discourse/admin/components/modal/penalize-user.gjs
+++ b/frontend/discourse/admin/components/modal/penalize-user.gjs
@@ -4,7 +4,7 @@ import { tracked } from "@glimmer/tracking";
import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import AdminPenaltyPostAction from "discourse/admin/components/admin-penalty-post-action";
import AdminPenaltyReason from "discourse/admin/components/admin-penalty-reason";
@@ -184,9 +184,9 @@ export default class PenalizeUser extends Component {
{{#if (eq @model.penaltyType "suspend")}}
<div class="penalty-reason-visibility">
{{#if this.siteSettings.hide_suspension_reasons}}
- {{htmlSafe (i18n "admin.user.suspend_reason_hidden_label")}}
+ {{trustHTML (i18n "admin.user.suspend_reason_hidden_label")}}
{{else}}
- {{htmlSafe (i18n "admin.user.suspend_reason_label")}}
+ {{trustHTML (i18n "admin.user.suspend_reason_label")}}
{{/if}}
</div>
{{/if}}
@@ -221,7 +221,7 @@ export default class PenalizeUser extends Component {
{{/if}}
</:body>
<:footer>
- <div class="penalty-history">{{htmlSafe this.penaltyHistory}}</div>
+ <div class="penalty-history">{{trustHTML this.penaltyHistory}}</div>
<DButton
class="btn-danger perform-penalize"
@action={{this.penalizeUser}}
diff --git a/frontend/discourse/admin/components/modal/site-setting-default-categories.gjs b/frontend/discourse/admin/components/modal/site-setting-default-categories.gjs
index 9a58d5ad21b..162aa6d568c 100644
--- a/frontend/discourse/admin/components/modal/site-setting-default-categories.gjs
+++ b/frontend/discourse/admin/components/modal/site-setting-default-categories.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n";
@@ -21,7 +21,7 @@ export default class SiteSettingDefaultCategories extends Component {
<template>
<DModal
class="incoming-emails"
- @title={{htmlSafe @model.siteSetting.key}}
+ @title={{trustHTML @model.siteSetting.key}}
@closeModal={{this.cancel}}
>
<:body>
diff --git a/frontend/discourse/admin/components/modal/staff-action-log-change.gjs b/frontend/discourse/admin/components/modal/staff-action-log-change.gjs
index 93ec60d5c09..99b5139bcdb 100644
--- a/frontend/discourse/admin/components/modal/staff-action-log-change.gjs
+++ b/frontend/discourse/admin/components/modal/staff-action-log-change.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { ajax } from "discourse/lib/ajax";
@@ -31,7 +31,7 @@ export default class AdminStaffActionLogComponent extends Component {
class="history-modal"
>
<:body>
- {{htmlSafe this.diff}}
+ {{trustHTML this.diff}}
</:body>
<:footer>
<DButton class="btn-primary" @action={{@closeModal}} @label="close" />
diff --git a/frontend/discourse/admin/components/modal/start-backup.gjs b/frontend/discourse/admin/components/modal/start-backup.gjs
index 40404c73dc5..7bc2137d723 100644
--- a/frontend/discourse/admin/components/modal/start-backup.gjs
+++ b/frontend/discourse/admin/components/modal/start-backup.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { Input } from "@ember/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n";
@@ -48,7 +48,7 @@ export default class StartBackup extends Component {
>
<:body>
{{#if this.warningMessage}}
- <div class={{this.warningCssClasses}}>{{htmlSafe
+ <div class={{this.warningCssClasses}}>{{trustHTML
this.warningMessage
}}</div>
{{/if}}
diff --git a/frontend/discourse/admin/components/schema-setting/field.gjs b/frontend/discourse/admin/components/schema-setting/field.gjs
index 5ea980c202a..8385883e631 100644
--- a/frontend/discourse/admin/components/schema-setting/field.gjs
+++ b/frontend/discourse/admin/components/schema-setting/field.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { cached } from "@glimmer/tracking";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import BooleanField from "discourse/admin/components/schema-setting/types/boolean";
import CategoriesField from "discourse/admin/components/schema-setting/types/categories";
import DatetimeField from "discourse/admin/components/schema-setting/types/datetime";
@@ -48,7 +48,7 @@ export default class SchemaSettingField extends Component {
return;
}
- return htmlSafe(this.args.description.trim().replace(/\n/g, "<br>"));
+ return trustHTML(this.args.description.trim().replace(/\n/g, "<br>"));
}
<template>
diff --git a/frontend/discourse/admin/components/silence-details.gjs b/frontend/discourse/admin/components/silence-details.gjs
index becf9856f94..428c7321c61 100644
--- a/frontend/discourse/admin/components/silence-details.gjs
+++ b/frontend/discourse/admin/components/silence-details.gjs
@@ -1,6 +1,6 @@
/* eslint-disable ember/no-classic-components */
import Component, { Textarea } from "@ember/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import TextField from "discourse/components/text-field";
import { i18n } from "discourse-i18n";
@@ -11,7 +11,7 @@ export default class SilenceDetails extends Component {
<div class="penalty-reason-controls">
<label>
<div class="silence-reason-label">
- {{htmlSafe (i18n "admin.user.silence_reason_label")}}
+ {{trustHTML (i18n "admin.user.silence_reason_label")}}
</div>
</label>
<TextField
diff --git a/frontend/discourse/admin/components/site-setting.gjs b/frontend/discourse/admin/components/site-setting.gjs
index 5179ac0afdf..7e87e458aa7 100644
--- a/frontend/discourse/admin/components/site-setting.gjs
+++ b/frontend/discourse/admin/components/site-setting.gjs
@@ -8,7 +8,7 @@ import { dependentKeyCompat } from "@ember/object/compat";
import { getOwner } from "@ember/owner";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isNone } from "@ember/utils";
import SettingValidationMessage from "discourse/admin/components/setting-validation-message";
import Description from "discourse/admin/components/site-settings/description";
@@ -149,7 +149,7 @@ export default class SiteSettingComponent extends Component {
}
get themeSiteSettingWarningText() {
- return htmlSafe(
+ return trustHTML(
i18n("admin.theme_site_settings.site_setting_warning", {
basePath,
defaultThemeName: sanitize(this.defaultTheme.name),
@@ -187,7 +187,7 @@ export default class SiteSettingComponent extends Component {
const preview = setting.preview;
if (preview) {
const escapedValue = preview.replace(/\{\{value\}\}/g, value);
- return htmlSafe(`<div class="preview">${escapedValue}</div>`);
+ return trustHTML(`<div class="preview">${escapedValue}</div>`);
}
return null;
}
@@ -348,7 +348,7 @@ export default class SiteSettingComponent extends Component {
let errorString = json.errors[0];
if (json.html_message) {
- errorString = htmlSafe(errorString);
+ errorString = trustHTML(errorString);
}
this.setting.validationMessage = errorString;
diff --git a/frontend/discourse/admin/components/site-settings/bool.gjs b/frontend/discourse/admin/components/site-settings/bool.gjs
index b46f60b1911..73cc6a81138 100644
--- a/frontend/discourse/admin/components/site-settings/bool.gjs
+++ b/frontend/discourse/admin/components/site-settings/bool.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
export default class Bool extends Component {
@@ -28,7 +28,7 @@ export default class Bool extends Component {
checked={{this.enabled}}
disabled={{@disabled}}
/>
- <span>{{htmlSafe @setting.description}}</span>
+ <span>{{trustHTML @setting.description}}</span>
</label>
</template>
}
diff --git a/frontend/discourse/admin/components/site-settings/description.gjs b/frontend/discourse/admin/components/site-settings/description.gjs
index dec8683079b..41a743ff8d8 100644
--- a/frontend/discourse/admin/components/site-settings/description.gjs
+++ b/frontend/discourse/admin/components/site-settings/description.gjs
@@ -1,5 +1,5 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
<template>
- <div class="desc">{{htmlSafe @description}}</div>
+ <div class="desc">{{trustHTML @description}}</div>
</template>
diff --git a/frontend/discourse/admin/components/site-settings/upload.gjs b/frontend/discourse/admin/components/site-settings/upload.gjs
index 9b962b1467c..6d4071ce5a5 100644
--- a/frontend/discourse/admin/components/site-settings/upload.gjs
+++ b/frontend/discourse/admin/components/site-settings/upload.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { getOwner } from "@ember/owner";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import DButton from "discourse/components/d-button";
import PickFilesButton from "discourse/components/pick-files-button";
@@ -173,8 +173,8 @@ export default class SiteSettingUpload extends Component {
get backgroundStyle() {
return this.isImageFile
- ? htmlSafe(`background-image: url(${this.fileCdnUrl})`)
- : htmlSafe("");
+ ? trustHTML(`background-image: url(${this.fileCdnUrl})`)
+ : trustHTML("");
}
get fileName() {
@@ -214,7 +214,7 @@ export default class SiteSettingUpload extends Component {
const progress = this.uppyUpload?.processing
? 100
: this.uppyUpload.uploadProgress || 0;
- return htmlSafe(`width: ${progress}%`);
+ return trustHTML(`width: ${progress}%`);
}
get restrictionsInfo() {
diff --git a/frontend/discourse/admin/components/themes-grid-placeholder.gjs b/frontend/discourse/admin/components/themes-grid-placeholder.gjs
index 3636d613c4e..f1ec2c55a6f 100644
--- a/frontend/discourse/admin/components/themes-grid-placeholder.gjs
+++ b/frontend/discourse/admin/components/themes-grid-placeholder.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { eq } from "discourse/truth-helpers";
export default class ThemesGridPlaceholder extends Component {
@@ -35,14 +35,14 @@ export default class ThemesGridPlaceholder extends Component {
let colors = this.themeColors;
return {
- primary: htmlSafe(colors.primary),
- secondary: htmlSafe(colors.secondary),
- tertiary: htmlSafe(colors.tertiary),
- quaternary: htmlSafe(colors.quaternary),
- highlight: htmlSafe(colors.highlight),
- danger: htmlSafe(colors.danger),
- success: htmlSafe(colors.success),
- love: htmlSafe(colors.love),
+ primary: trustHTML(colors.primary),
+ secondary: trustHTML(colors.secondary),
+ tertiary: trustHTML(colors.tertiary),
+ quaternary: trustHTML(colors.quaternary),
+ highlight: trustHTML(colors.highlight),
+ danger: trustHTML(colors.danger),
+ success: trustHTML(colors.success),
+ love: trustHTML(colors.love),
};
}
diff --git a/frontend/discourse/admin/components/themes-list-item.gjs b/frontend/discourse/admin/components/themes-list-item.gjs
index 710ffc27b4a..7656760154b 100644
--- a/frontend/discourse/admin/components/themes-list-item.gjs
+++ b/frontend/discourse/admin/components/themes-list-item.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { Input } from "@ember/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
@@ -142,7 +142,7 @@ export default class ThemesListItem extends Component {
{{#if this.displayComponents}}
<div class="components-list">
- <span class="components">{{htmlSafe this.childrenString}}</span>
+ <span class="components">{{trustHTML this.childrenString}}</span>
{{#if this.displayHasMore}}
<a
diff --git a/frontend/discourse/admin/components/upsert-category/general.gjs b/frontend/discourse/admin/components/upsert-category/general.gjs
index 7103d309369..4c812dfb6e9 100644
--- a/frontend/discourse/admin/components/upsert-category/general.gjs
+++ b/frontend/discourse/admin/components/upsert-category/general.gjs
@@ -3,7 +3,7 @@ import { concat, hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import EmojiPicker from "discourse/components/emoji-picker";
import DTooltip from "discourse/float-kit/components/d-tooltip";
import categoryBadge from "discourse/helpers/category-badge";
@@ -184,7 +184,7 @@ export default class UpsertCategoryGeneral extends Component {
const key = this.isParentRestricted
? "category.visibility.inherited_from_parent"
: "category.visibility.more_options_hint";
- return htmlSafe(i18n(key));
+ return trustHTML(i18n(key));
}
@action
@@ -342,7 +342,7 @@ export default class UpsertCategoryGeneral extends Component {
>
{{#if this.showWarning}}
<@form.Alert @type="warning" @icon="triangle-exclamation">
- {{htmlSafe
+ {{trustHTML
(i18n
"category.uncategorized_general_warning"
settingLink=this.uncategorizedSiteSettingLink
@@ -433,7 +433,7 @@ export default class UpsertCategoryGeneral extends Component {
}}
@onChange={{field.set}}
class="form-kit__control-icon"
- style={{htmlSafe
+ style={{trustHTML
(concat "--icon-color: #" @transientData.color ";")
}}
/>
@@ -466,7 +466,7 @@ export default class UpsertCategoryGeneral extends Component {
</Content>
<Content @name="square">
- {{htmlSafe
+ {{trustHTML
(categoryBadge
(this.buildTransientModel @transientData) styleType="square"
)
diff --git a/frontend/discourse/admin/components/upsert-category/settings.gjs b/frontend/discourse/admin/components/upsert-category/settings.gjs
index 8306907df76..244637f0652 100644
--- a/frontend/discourse/admin/components/upsert-category/settings.gjs
+++ b/frontend/discourse/admin/components/upsert-category/settings.gjs
@@ -3,7 +3,7 @@ import { hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import RelativeTimePicker from "discourse/components/relative-time-picker";
import concatClass from "discourse/helpers/concat-class";
@@ -328,7 +328,7 @@ export default class UpsertCategorySettings extends Component {
/>
{{else}}
<@form.Alert @type="info">
- {{htmlSafe
+ {{trustHTML
(i18n
"category.email_in_disabled"
setting_url=(getUrl
diff --git a/frontend/discourse/admin/controllers/admin-email/server-settings.js b/frontend/discourse/admin/controllers/admin-email/server-settings.js
index 29784b617ce..a149212e11d 100644
--- a/frontend/discourse/admin/controllers/admin-email/server-settings.js
+++ b/frontend/discourse/admin/controllers/admin-email/server-settings.js
@@ -3,7 +3,7 @@ import Controller from "@ember/controller";
import { action } from "@ember/object";
import { empty } from "@ember/object/computed";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { observes } from "@ember-decorators/object";
import { ajax } from "discourse/lib/ajax";
import { escapeExpression } from "discourse/lib/utilities";
@@ -51,7 +51,7 @@ export default class AdminEmailIndexController extends Controller {
.catch((e) => {
if (e.jqXHR.responseJSON?.errors) {
this.dialog.alert({
- message: htmlSafe(
+ message: trustHTML(
i18n("admin.email.error", {
server_error: escapeExpression(e.jqXHR.responseJSON.errors[0]),
})
diff --git a/frontend/discourse/admin/controllers/admin-user/index.js b/frontend/discourse/admin/controllers/admin-user/index.js
index d6a7b7a9af1..a928d5aa827 100644
--- a/frontend/discourse/admin/controllers/admin-user/index.js
+++ b/frontend/discourse/admin/controllers/admin-user/index.js
@@ -3,7 +3,7 @@ import Controller from "@ember/controller";
import { action, computed } from "@ember/object";
import { and, notEmpty } from "@ember/object/computed";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminUser from "discourse/admin/models/admin-user";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
@@ -64,7 +64,7 @@ export default class AdminUserIndexController extends Controller {
get automaticGroups() {
return this.model.automaticGroups
.map((group) => {
- const name = htmlSafe(group.name);
+ const name = trustHTML(group.name);
return `<a href="/g/${name}">${name}</a>`;
})
.join(", ");
diff --git a/frontend/discourse/admin/helpers/check-icon.js b/frontend/discourse/admin/helpers/check-icon.js
index 71e1dafde67..2c1c10327b7 100644
--- a/frontend/discourse/admin/helpers/check-icon.js
+++ b/frontend/discourse/admin/helpers/check-icon.js
@@ -1,7 +1,7 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { renderIcon } from "discourse/lib/icon-library";
export default function checkIcon(value) {
let icon = value ? "check" : "xmark";
- return htmlSafe(renderIcon("string", icon));
+ return trustHTML(renderIcon("string", icon));
}
diff --git a/frontend/discourse/admin/helpers/human-size.js b/frontend/discourse/admin/helpers/human-size.js
index a4cd06a3b0d..391baf6e61a 100644
--- a/frontend/discourse/admin/helpers/human-size.js
+++ b/frontend/discourse/admin/helpers/human-size.js
@@ -1,6 +1,6 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import I18n from "discourse-i18n";
export default function (size) {
- return htmlSafe(I18n.toHumanSize(size));
+ return trustHTML(I18n.toHumanSize(size));
}
diff --git a/frontend/discourse/admin/services/admin-tools.js b/frontend/discourse/admin/services/admin-tools.js
index 179f2089a37..73eaae840c2 100644
--- a/frontend/discourse/admin/services/admin-tools.js
+++ b/frontend/discourse/admin/services/admin-tools.js
@@ -1,6 +1,6 @@
import { action } from "@ember/object";
import Service, { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { Promise } from "rsvp";
import DeleteUserPostsProgressModal from "discourse/admin/components/modal/delete-user-posts-progress";
import PenalizeUserModal from "discourse/admin/components/modal/penalize-user";
@@ -81,7 +81,7 @@ export default class AdminToolsService extends Service {
: Promise.resolve();
return tryEmail.then(() => {
- let message = htmlSafe(
+ let message = trustHTML(
I18n.messageFormat("flagging.delete_confirm_MF", {
POSTS: adminUser.get("post_count"),
TOPICS: adminUser.get("topic_count"),
diff --git a/frontend/discourse/admin/templates/admin-config/color-palettes/index.gjs b/frontend/discourse/admin/templates/admin-config/color-palettes/index.gjs
index 043e105b954..3d1bd599efa 100644
--- a/frontend/discourse/admin/templates/admin-config/color-palettes/index.gjs
+++ b/frontend/discourse/admin/templates/admin-config/color-palettes/index.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminFilterControls from "discourse/admin/components/admin-filter-controls";
import ColorPaletteListItem from "discourse/admin/components/color-palette-list-item";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
@@ -45,7 +45,7 @@ export default <template>
{{#if @controller.preferencesWarningMessage}}
<p class="color-palette__warning">
{{#if @controller.preferencesWarningMessage.usingNonDefaultTheme}}
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.customize.colors.non_default_theme_warning"
@@ -53,7 +53,7 @@ export default <template>
)
}}
{{else}}
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.customize.colors.custom_schemes_warning"
diff --git a/frontend/discourse/admin/templates/admin-customize-themes/show.gjs b/frontend/discourse/admin/templates/admin-customize-themes/show.gjs
index 1a0f7437420..0fb9283f8a0 100644
--- a/frontend/discourse/admin/templates/admin-customize-themes/show.gjs
+++ b/frontend/discourse/admin/templates/admin-customize-themes/show.gjs
@@ -1,5 +1,5 @@
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
import TextField from "discourse/components/text-field";
@@ -218,7 +218,7 @@ export default <template>
{{#if @controller.model.remote_theme.is_git}}
<div class="alert alert-info remote-theme-edits">
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.customize.theme.remote_theme_edits"
diff --git a/frontend/discourse/admin/templates/admin-customize-themes/show/index.gjs b/frontend/discourse/admin/templates/admin-customize-themes/show/index.gjs
index f55b798013e..a629849286a 100644
--- a/frontend/discourse/admin/templates/admin-customize-themes/show/index.gjs
+++ b/frontend/discourse/admin/templates/admin-customize-themes/show/index.gjs
@@ -1,6 +1,6 @@
import { fn, hash } from "@ember/helper";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import InlineEditCheckbox from "discourse/admin/components/inline-edit-checkbox";
import ThemeSettingEditor from "discourse/admin/components/theme-setting-editor";
import ThemeSettingRelativesSelector from "discourse/admin/components/theme-setting-relatives-selector";
@@ -348,7 +348,7 @@ export default <template>
<div class="mini-title">{{i18n
"admin.customize.theme.theme_site_settings"
}}</div>
- <p><i>{{htmlSafe
+ <p><i>{{trustHTML
(i18n
"admin.customize.theme.overriden_site_settings_explanation"
themeSiteSettingsConfigUrl=(getURL
diff --git a/frontend/discourse/admin/templates/admin-email/advanced-test.gjs b/frontend/discourse/admin/templates/admin-email/advanced-test.gjs
index b2a637977ca..e0f9914c60c 100644
--- a/frontend/discourse/admin/templates/admin-email/advanced-test.gjs
+++ b/frontend/discourse/admin/templates/admin-email/advanced-test.gjs
@@ -1,5 +1,5 @@
import { Textarea } from "@ember/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import DPageSubheader from "discourse/components/d-page-subheader";
@@ -26,12 +26,12 @@ export default <template>
<hr />
<div class="text">
<h3>{{i18n "admin.email.advanced_test.text"}}</h3>
- <pre class="full-reason">{{htmlSafe @controller.text}}</pre>
+ <pre class="full-reason">{{trustHTML @controller.text}}</pre>
</div>
<hr />
<div class="elided">
<h3>{{i18n "admin.email.advanced_test.elided"}}</h3>
- <pre class="full-reason">{{htmlSafe @controller.elided}}</pre>
+ <pre class="full-reason">{{trustHTML @controller.elided}}</pre>
</div>
{{/if}}
</ConditionalLoadingSpinner>
diff --git a/frontend/discourse/admin/templates/admin-embedding/index.gjs b/frontend/discourse/admin/templates/admin-embedding/index.gjs
index 0c9cca19c7e..3adf311ac79 100644
--- a/frontend/discourse/admin/templates/admin-embedding/index.gjs
+++ b/frontend/discourse/admin/templates/admin-embedding/index.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminConfigAreaCard from "discourse/admin/components/admin-config-area-card";
import AdminConfigAreaEmptyList from "discourse/admin/components/admin-config-area-empty-list";
import EmbeddableHost from "discourse/admin/components/embeddable-host";
@@ -17,7 +17,7 @@ export default <template>
class="admin-embedding-index__code"
>
<:content>
- {{htmlSafe (i18n "admin.embedding.sample")}}
+ {{trustHTML (i18n "admin.embedding.sample")}}
<HighlightedCode @code={{@controller.embeddingCode}} @lang="html" />
</:content>
</AdminConfigAreaCard>
diff --git a/frontend/discourse/admin/templates/admin-logs/staff-action-logs.gjs b/frontend/discourse/admin/templates/admin-logs/staff-action-logs.gjs
index f99599a7c09..5dd4740fa60 100644
--- a/frontend/discourse/admin/templates/admin-logs/staff-action-logs.gjs
+++ b/frontend/discourse/admin/templates/admin-logs/staff-action-logs.gjs
@@ -1,7 +1,7 @@
import { concat, fn, hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import StaffActions from "discourse/admin/components/staff-actions";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
@@ -176,7 +176,7 @@ export default <template>
}}</td>
<td class="col value details">
<div>
- {{htmlSafe item.formattedDetails}}
+ {{trustHTML item.formattedDetails}}
{{#if item.useCustomModalForDetails}}
<a
href
@@ -198,7 +198,7 @@ export default <template>
</td>
<td class="col value context">
{{#if (fn @controller.showHtmlSafeContext item)}}
- {{htmlSafe item.context}}
+ {{trustHTML item.context}}
{{else}}
{{item.context}}
{{/if}}
diff --git a/frontend/discourse/admin/templates/admin-plugins/index.gjs b/frontend/discourse/admin/templates/admin-plugins/index.gjs
index b6163366607..e0c25323504 100644
--- a/frontend/discourse/admin/templates/admin-plugins/index.gjs
+++ b/frontend/discourse/admin/templates/admin-plugins/index.gjs
@@ -1,5 +1,5 @@
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminFilterControls from "discourse/admin/components/admin-filter-controls";
import AdminPluginsList from "discourse/admin/components/admin-plugins-list";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
@@ -14,7 +14,7 @@ export default <template>
<DPageHeader
@titleLabel={{i18n "admin.config.plugins.title"}}
- @descriptionLabel={{htmlSafe
+ @descriptionLabel={{trustHTML
(concat
(i18n "admin.config.plugins.header_description")
'<a class="admin-plugins-howto" href="https://meta.discourse.org/t/install-a-plugin/19157">'
diff --git a/frontend/discourse/admin/templates/admin-search-logs/term.gjs b/frontend/discourse/admin/templates/admin-search-logs/term.gjs
index e0e1d271da9..c5173a8e390 100644
--- a/frontend/discourse/admin/templates/admin-search-logs/term.gjs
+++ b/frontend/discourse/admin/templates/admin-search-logs/term.gjs
@@ -1,6 +1,6 @@
import { fn, hash } from "@ember/helper";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import Chart from "discourse/admin/components/chart";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import HighlightSearch from "discourse/components/highlight-search";
@@ -56,10 +56,10 @@ export default <template>
<TopicStatus @topic={{result.topic}} @disableActions={{true}} />
<span class="topic-title">
{{#if result.useTopicTitleHeadline}}
- {{htmlSafe result.topicTitleHeadline}}
+ {{trustHTML result.topicTitleHeadline}}
{{else}}
<HighlightSearch @highlight={{@controller.q}}>
- {{htmlSafe result.topic.fancyTitle}}
+ {{trustHTML result.topic.fancyTitle}}
</HighlightSearch>
{{/if}}
</span>
@@ -86,10 +86,10 @@ export default <template>
{{#if result.blurb}}
{{#if @controller.siteSettings.use_pg_headlines_for_excerpt}}
- {{htmlSafe result.blurb}}
+ {{trustHTML result.blurb}}
{{else}}
<HighlightSearch @highlight={{@controller.highlightQuery}}>
- {{htmlSafe result.blurb}}
+ {{trustHTML result.blurb}}
</HighlightSearch>
{{/if}}
{{/if}}
diff --git a/frontend/discourse/admin/templates/admin-user/index.gjs b/frontend/discourse/admin/templates/admin-user/index.gjs
index a5f7b82e14d..895784ee42f 100644
--- a/frontend/discourse/admin/templates/admin-user/index.gjs
+++ b/frontend/discourse/admin/templates/admin-user/index.gjs
@@ -1,6 +1,6 @@
import { fn, hash } from "@ember/helper";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminEditableField from "discourse/admin/components/admin-editable-field";
import AdminUserExportsTable from "discourse/admin/components/admin-user-exports-table";
import AdminUserUpcomingChanges from "discourse/admin/components/admin-user-upcoming-changes";
@@ -107,7 +107,7 @@ export default <template>
{{#if @controller.siteSettings.auth_overrides_email}}
{{i18n "user.email.auth_override_instructions"}}
{{else if @controller.model.email}}
- {{htmlSafe
+ {{trustHTML
(i18n "admin.user.visit_profile" [email protected])
}}
{{/if}}
@@ -145,7 +145,7 @@ export default <template>
{{#if @controller.siteSettings.auth_overrides_email}}
{{i18n "user.email.auth_override_instructions"}}
{{else}}
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.user.visit_profile" [email protected]
)
@@ -209,7 +209,7 @@ export default <template>
<div class="field">{{i18n "user.avatar.title"}}</div>
<div class="value">{{avatar @controller.model imageSize="large"}}</div>
<div class="controls">
- {{htmlSafe
+ {{trustHTML
(i18n "admin.user.visit_profile" [email protected])
}}
</div>
@@ -575,7 +575,7 @@ export default <template>
</div>
<div class="controls">
<strong>{{i18n "admin.user.suspend_reason"}}</strong>:
- <div class="full-reason">{{htmlSafe
+ <div class="full-reason">{{trustHTML
@controller.model.full_suspend_reason
}}</div>
</div>
@@ -638,7 +638,7 @@ export default <template>
</div>
<div class="controls">
<b>{{i18n "admin.user.silence_reason"}}</b>:
- <div class="full-reason">{{htmlSafe
+ <div class="full-reason">{{trustHTML
@controller.model.silence_reason
}}</div>
</div>
@@ -672,7 +672,7 @@ export default <template>
<h1>{{i18n "admin.groups.title"}}</h1>
<div class="display-row admin-user__automatic-groups">
<div class="field">{{i18n "admin.groups.automatic"}}</div>
- <div class="value">{{htmlSafe @controller.automaticGroups}}</div>
+ <div class="value">{{trustHTML @controller.automaticGroups}}</div>
</div>
<div class="display-row admin-user__custom-groups">
<div class="field">{{i18n "admin.groups.custom"}}</div>
@@ -823,7 +823,7 @@ export default <template>
</div>
<div class="display-row">
<div class="field">{{i18n "user.invited.days_visited"}}</div>
- <div class="value">{{htmlSafe @controller.model.days_visited}}</div>
+ <div class="value">{{trustHTML @controller.model.days_visited}}</div>
</div>
<div class="display-row post-edits-count">
<div class="field">{{i18n "admin.user.post_edits_count"}}</div>
@@ -938,7 +938,7 @@ export default <template>
}}
<section class="details">
<h1>{{i18n "admin.user.upcoming_changes.title"}}</h1>
- <p>{{htmlSafe
+ <p>{{trustHTML
(i18n "admin.user.upcoming_changes.description" basePath=basePath)
}}</p>
<AdminUserUpcomingChanges @user={{@controller.model}} />
diff --git a/frontend/discourse/admin/templates/admin-users-list/show.gjs b/frontend/discourse/admin/templates/admin-users-list/show.gjs
index bbba514d73c..fd994b9d373 100644
--- a/frontend/discourse/admin/templates/admin-users-list/show.gjs
+++ b/frontend/discourse/admin/templates/admin-users-list/show.gjs
@@ -1,7 +1,7 @@
import { concat, fn, get } from "@ember/helper";
import { on } from "@ember/modifier";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import DPageSubheader from "discourse/components/d-page-subheader";
@@ -93,10 +93,10 @@ export default <template>
<ResponsiveTable
@className={{concatClass "users-list" @controller.query}}
@ariaLabel={{@controller.title}}
- @style={{htmlSafe
+ @style={{trustHTML
(concat
"grid-template-columns: minmax(min-content, 2fr) repeat("
- (htmlSafe @controller.columnCount)
+ (trustHTML @controller.columnCount)
", minmax(min-content, 1fr))"
)
}}
@@ -362,7 +362,7 @@ export default <template>
<span>{{i18n "admin.users.silence_reason"}}</span>
</span>
<span class="directory-table__value">
- {{htmlSafe user.silence_reason}}
+ {{trustHTML user.silence_reason}}
</span>
</div>
{{/if}}
diff --git a/frontend/discourse/admin/templates/admin-watched-words/action.gjs b/frontend/discourse/admin/templates/admin-watched-words/action.gjs
index f99bada19e0..0cb5af21c9e 100644
--- a/frontend/discourse/admin/templates/admin-watched-words/action.gjs
+++ b/frontend/discourse/admin/templates/admin-watched-words/action.gjs
@@ -1,5 +1,5 @@
import { Input } from "@ember/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminWatchedWord from "discourse/admin/components/admin-watched-word";
import WatchedWordForm from "discourse/admin/components/watched-word-form";
import WatchedWordUploader from "discourse/admin/components/watched-word-uploader";
@@ -55,7 +55,7 @@ export default <template>
{{#if @controller.siteSettings.watched_words_regular_expressions}}
<p>
- {{htmlSafe
+ {{trustHTML
(i18n "admin.watched_words.regex_warning" basePath=(basePath))
}}
</p>
diff --git a/frontend/discourse/admin/templates/admin/backups/index.gjs b/frontend/discourse/admin/templates/admin/backups/index.gjs
index 3643bd8b99f..5aa037e7c0c 100644
--- a/frontend/discourse/admin/templates/admin/backups/index.gjs
+++ b/frontend/discourse/admin/templates/admin/backups/index.gjs
@@ -1,5 +1,5 @@
import { fn } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import UppyBackupUploader from "discourse/admin/components/uppy-backup-uploader";
import humanSize from "discourse/admin/helpers/human-size";
import DButton from "discourse/components/d-button";
@@ -35,7 +35,7 @@ export default <template>
{{#if @controller.status.restoreDisabled}}
<div class="backup-message alert alert-info">
{{icon "circle-info"}}
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.backups.operations.restore.is_disabled"
diff --git a/frontend/discourse/admin/templates/admin/dashboard/general.gjs b/frontend/discourse/admin/templates/admin/dashboard/general.gjs
index f9c0fed1cdf..db0f4449dd9 100644
--- a/frontend/discourse/admin/templates/admin/dashboard/general.gjs
+++ b/frontend/discourse/admin/templates/admin/dashboard/general.gjs
@@ -1,5 +1,5 @@
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminReport from "discourse/admin/components/admin-report";
import DashboardPeriodSelector from "discourse/admin/components/dashboard-period-selector";
import ConditionalLoadingSection from "discourse/components/conditional-loading-section";
@@ -204,7 +204,7 @@ export default <template>
@isEnabled={{@controller.logSearchQueriesEnabled}}
@disabledLabel={{@controller.trendingSearchDisabledLabel}}
/>
- {{htmlSafe
+ {{trustHTML
(i18n
"admin.dashboard.reports.trending_search.more" basePath=(basePath)
)
diff --git a/frontend/discourse/admin/templates/dashboard-new-features.gjs b/frontend/discourse/admin/templates/dashboard-new-features.gjs
index 60b7346c215..df82718a86c 100644
--- a/frontend/discourse/admin/templates/dashboard-new-features.gjs
+++ b/frontend/discourse/admin/templates/dashboard-new-features.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DashboardNewFeatures from "discourse/admin/components/dashboard-new-features";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import { i18n } from "discourse-i18n";
@@ -7,7 +7,7 @@ export default <template>
<ConditionalLoadingSpinner @condition={{@controller.isLoading}}>
<div class="admin-config-area">
<h2>{{i18n "admin.dashboard.new_features.title"}}</h2>
- <p>{{htmlSafe (i18n "admin.dashboard.new_features.subtitle")}}</p>
+ <p>{{trustHTML (i18n "admin.dashboard.new_features.subtitle")}}</p>
<DashboardNewFeatures />
</div>
</ConditionalLoadingSpinner>
diff --git a/frontend/discourse/admin/templates/edit-category/tabs.gjs b/frontend/discourse/admin/templates/edit-category/tabs.gjs
index 24c158efdf1..43743728b1e 100644
--- a/frontend/discourse/admin/templates/edit-category/tabs.gjs
+++ b/frontend/discourse/admin/templates/edit-category/tabs.gjs
@@ -1,5 +1,5 @@
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ChangesBanner from "discourse/admin/components/changes-banner";
import EditCategoryGeneral from "discourse/admin/components/edit-category-general";
import EditCategoryImages from "discourse/admin/components/edit-category-images";
@@ -119,7 +119,7 @@ export default <template>
{{#if @controller.showDeleteReason}}
<form.Alert @type="warning" class="edit-category-delete-warning">
- {{htmlSafe @controller.model.cannot_delete_reason}}
+ {{trustHTML @controller.model.cannot_delete_reason}}
</form.Alert>
{{/if}}
diff --git a/frontend/discourse/app/components/about-page-extra-groups.gjs b/frontend/discourse/app/components/about-page-extra-groups.gjs
index 61f3481e413..ce1ae3b4c0c 100644
--- a/frontend/discourse/app/components/about-page-extra-groups.gjs
+++ b/frontend/discourse/app/components/about-page-extra-groups.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AboutPageUsers from "discourse/components/about-page-users";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import { ajax } from "discourse/lib/ajax";
@@ -120,7 +120,7 @@ export default class AboutPageExtraGroups extends Component {
<a href="/g/{{group.name}}">{{this.groupName group}}</a>
</h3>
{{#if this.showGroupDescription}}
- <p>{{htmlSafe group.bio_cooked}}</p>
+ <p>{{trustHTML group.bio_cooked}}</p>
{{/if}}
<AboutPageUsers
@users={{group.members}}
diff --git a/frontend/discourse/app/components/about-page.gjs b/frontend/discourse/app/components/about-page.gjs
index e24a86386f4..7533481e712 100644
--- a/frontend/discourse/app/components/about-page.gjs
+++ b/frontend/discourse/app/components/about-page.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isBlank } from "@ember/utils";
import AboutPageExtraGroups from "discourse/components/about-page-extra-groups";
import AboutPageUsers from "discourse/components/about-page-users";
@@ -274,7 +274,7 @@ export default class AboutPage extends Component {
{{#if @model.extended_site_description}}
<h3>{{i18n "about.simple_title"}}</h3>
- <div>{{htmlSafe @model.extended_site_description}}</div>
+ <div>{{trustHTML @model.extended_site_description}}</div>
{{/if}}
{{#if @model.admins.length}}
@@ -308,7 +308,7 @@ export default class AboutPage extends Component {
<div class="about__right-side">
<h3>{{i18n "about.contact"}}</h3>
{{#if this.contactInfo}}
- <p class="about__contact-info">{{htmlSafe this.contactInfo}}</p>
+ <p class="about__contact-info">{{trustHTML this.contactInfo}}</p>
{{/if}}
<p>{{i18n "about.report_inappropriate_content"}}</p>
<h3>{{i18n "about.site_activity"}}</h3>
diff --git a/frontend/discourse/app/components/async-content.gjs b/frontend/discourse/app/components/async-content.gjs
index e1e202a4288..ded7cb4c1c4 100644
--- a/frontend/discourse/app/components/async-content.gjs
+++ b/frontend/discourse/app/components/async-content.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { cached } from "@glimmer/tracking";
import { hash } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { TrackedAsyncData } from "ember-async-data";
import { Promise as RsvpPromise } from "rsvp";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
@@ -127,7 +127,7 @@ export default class AsyncContent extends Component {
class AsyncContentInlineError extends Component {
get errorMessage() {
const errorInfo = extractErrorInfo(this.args.error);
- return errorInfo.html ? htmlSafe(errorInfo.message) : errorInfo.message;
+ return errorInfo.html ? trustHTML(errorInfo.message) : errorInfo.message;
}
<template>
diff --git a/frontend/discourse/app/components/avatar-flair.gjs b/frontend/discourse/app/components/avatar-flair.gjs
index 8c38a1d1488..0d2aec70c93 100644
--- a/frontend/discourse/app/components/avatar-flair.gjs
+++ b/frontend/discourse/app/components/avatar-flair.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
import { convertIconClass } from "discourse/lib/icon-library";
@@ -34,7 +34,7 @@ export default class AvatarFlair extends Component {
css.push("color: #" + escapeExpression(this.args.flairColor));
}
- return css.length > 0 ? htmlSafe(css.join("; ")) : null;
+ return css.length > 0 ? trustHTML(css.join("; ")) : null;
}
get title() {
diff --git a/frontend/discourse/app/components/badge-card.gjs b/frontend/discourse/app/components/badge-card.gjs
index 1241769dd8f..55293fd9737 100644
--- a/frontend/discourse/app/components/badge-card.gjs
+++ b/frontend/discourse/app/components/badge-card.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import DButton from "discourse/components/d-button";
import icon from "discourse/helpers/d-icon";
@@ -95,11 +95,11 @@ export default class BadgeCard extends Component {
{{/if}}
</h3>
<div id="badge-summary-{{@badge.slug}}" class="badge-summary">
- {{htmlSafe this.summary}}
+ {{trustHTML this.summary}}
</div>
{{#if this.displayCount}}
<div id="badge-granted-{{@badge.slug}}" class="badge-granted">
- {{htmlSafe
+ {{trustHTML
(i18n
"badges.awarded"
count=this.displayCount
diff --git a/frontend/discourse/app/components/bookmark-list.gjs b/frontend/discourse/app/components/bookmark-list.gjs
index f5fd2af13ea..b4a503f03b8 100644
--- a/frontend/discourse/app/components/bookmark-list.gjs
+++ b/frontend/discourse/app/components/bookmark-list.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { dependentKeyCompat } from "@ember/object/compat";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNames } from "@ember-decorators/component";
import { Promise } from "rsvp";
import BookmarkActionsDropdown from "discourse/components/bookmark-actions-dropdown";
@@ -383,7 +383,7 @@ export default class BookmarkList extends Component {
<p
class="post-excerpt"
{{on "click" this.screenExcerptForExternalLink}}
- >{{htmlSafe bookmark.excerpt}}</p>
+ >{{trustHTML bookmark.excerpt}}</p>
{{/if}}
</td>
{{#if this.site.desktopView}}
diff --git a/frontend/discourse/app/components/bulk-actions/notification-level.gjs b/frontend/discourse/app/components/bulk-actions/notification-level.gjs
index c4474685f13..16a648403d3 100644
--- a/frontend/discourse/app/components/bulk-actions/notification-level.gjs
+++ b/frontend/discourse/app/components/bulk-actions/notification-level.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import { empty } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import RadioButton from "discourse/components/radio-button";
import { topicLevels } from "discourse/lib/notification-levels";
@@ -40,7 +40,7 @@ export default class NotificationLevel extends Component {
@selection={{this.notificationLevelId}}
/>
<strong>{{level.name}}</strong>
- <div class="description">{{htmlSafe level.description}}</div>
+ <div class="description">{{trustHTML level.description}}</div>
</label>
</div>
{{/each}}
diff --git a/frontend/discourse/app/components/categories-boxes-topic.gjs b/frontend/discourse/app/components/categories-boxes-topic.gjs
index 1bc39dec363..a57eca9d242 100644
--- a/frontend/discourse/app/components/categories-boxes-topic.gjs
+++ b/frontend/discourse/app/components/categories-boxes-topic.gjs
@@ -1,7 +1,7 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import icon from "discourse/helpers/d-icon";
@@ -23,7 +23,7 @@ export default class CategoriesBoxesTopic extends Component {
{{icon this.topicStatusIcon}}
<a href={{this.topic.lastUnreadUrl}} class="title">
- {{htmlSafe this.topic.fancyTitle}}
+ {{trustHTML this.topic.fancyTitle}}
</a>
</li>
</template>
diff --git a/frontend/discourse/app/components/categories-boxes-with-topics.gjs b/frontend/discourse/app/components/categories-boxes-with-topics.gjs
index e2e15487313..fd6a3cf1846 100644
--- a/frontend/discourse/app/components/categories-boxes-with-topics.gjs
+++ b/frontend/discourse/app/components/categories-boxes-with-topics.gjs
@@ -1,6 +1,6 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { tagName } from "@ember-decorators/component";
import CategoriesBoxesTopic from "discourse/components/categories-boxes-topic";
@@ -21,7 +21,7 @@ export default class CategoriesBoxesWithTopics extends Component {
}
categoryName(category) {
- return htmlSafe(
+ return trustHTML(
categoryBadgeHTML(category, {
allowUncategorized: true,
link: false,
diff --git a/frontend/discourse/app/components/categories-boxes.gjs b/frontend/discourse/app/components/categories-boxes.gjs
index 150a8c50333..8dd95349af4 100644
--- a/frontend/discourse/app/components/categories-boxes.gjs
+++ b/frontend/discourse/app/components/categories-boxes.gjs
@@ -1,6 +1,6 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { tagName } from "@ember-decorators/component";
import CategoryLogo from "discourse/components/category-logo";
@@ -28,7 +28,7 @@ export default class CategoriesBoxes extends Component {
}
categoryName(category) {
- return htmlSafe(
+ return trustHTML(
categoryBadgeHTML(category, {
allowUncategorized: true,
link: false,
diff --git a/frontend/discourse/app/components/category-read-only-banner.gjs b/frontend/discourse/app/components/category-read-only-banner.gjs
index 3530b4e0e44..2e36db72fd8 100644
--- a/frontend/discourse/app/components/category-read-only-banner.gjs
+++ b/frontend/discourse/app/components/category-read-only-banner.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
export default class CategoryReadOnlyBanner extends Component {
@service currentUser;
@@ -17,7 +17,7 @@ export default class CategoryReadOnlyBanner extends Component {
{{#if this.shouldShow}}
<div class="row">
<div class="alert alert-info category-read-only-banner">
- {{htmlSafe @category.read_only_banner}}
+ {{trustHTML @category.read_only_banner}}
</div>
</div>
{{/if}}
diff --git a/frontend/discourse/app/components/cdn-img.gjs b/frontend/discourse/app/components/cdn-img.gjs
index 81dcf90e178..7e0069f9d76 100644
--- a/frontend/discourse/app/components/cdn-img.gjs
+++ b/frontend/discourse/app/components/cdn-img.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { getURLWithCDN } from "discourse/lib/get-url";
export default class CdnImg extends Component {
@@ -9,7 +9,9 @@ export default class CdnImg extends Component {
get style() {
if (this.args.width && this.args.height) {
- return htmlSafe(`--aspect-ratio: ${this.args.width / this.args.height};`);
+ return trustHTML(
+ `--aspect-ratio: ${this.args.width / this.args.height};`
+ );
}
}
diff --git a/frontend/discourse/app/components/color-palette-preview.gjs b/frontend/discourse/app/components/color-palette-preview.gjs
index b5fd3d9f08d..3e97fda7831 100644
--- a/frontend/discourse/app/components/color-palette-preview.gjs
+++ b/frontend/discourse/app/components/color-palette-preview.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import SvgSingleColorPalettePlaceholder from "discourse/components/svg/single-color-palette-placeholder";
import { getColorSchemeStyles } from "discourse/lib/color-transformations";
@@ -14,7 +14,7 @@ export default class ColorPalettePreview extends Component {
get styles() {
if (this.isBuiltInDefault) {
- return htmlSafe(
+ return trustHTML(
"--primary-low--preview: #e9e9e9; --tertiary-low--preview: #d1f0ff;"
);
}
@@ -42,7 +42,7 @@ export default class ColorPalettePreview extends Component {
? `${existingStyles} ${colorVariables};`
: existingStyles;
- return htmlSafe(allStyles);
+ return trustHTML(allStyles);
}
<template>
diff --git a/frontend/discourse/app/components/color-picker-choice.js b/frontend/discourse/app/components/color-picker-choice.js
index 6884d2e54a4..28565cc9c1d 100644
--- a/frontend/discourse/app/components/color-picker-choice.js
+++ b/frontend/discourse/app/components/color-picker-choice.js
@@ -1,7 +1,7 @@
/* eslint-disable ember/no-classic-components, ember/require-tagless-components */
import Component from "@ember/component";
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import {
attributeBindings,
classNameBindings,
@@ -25,7 +25,7 @@ export default class ColorPickerChoice extends Component {
@computed("color")
get style() {
- return htmlSafe(`background-color: #${this.color};`);
+ return trustHTML(`background-color: #${this.color};`);
}
click(e) {
diff --git a/frontend/discourse/app/components/composer-action-title.gjs b/frontend/discourse/app/components/composer-action-title.gjs
index b1b9a46b006..dddefc8baf7 100644
--- a/frontend/discourse/app/components/composer-action-title.gjs
+++ b/frontend/discourse/app/components/composer-action-title.gjs
@@ -4,7 +4,7 @@ import { hash } from "@ember/helper";
import { computed } from "@ember/object";
import { alias } from "@ember/object/computed";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import PostLanguageSelector from "discourse/components/post-language-selector";
import escape from "discourse/lib/escape";
@@ -102,11 +102,11 @@ export default class ComposerActionTitle extends Component {
`;
}
- return htmlSafe(editTitle);
+ return trustHTML(editTitle);
}
_formatReplyToTopic(link) {
- return htmlSafe(
+ return trustHTML(
`<a class="topic-link" href="${link.href}" data-topic-id="${this.get(
"model.topic.id"
)}">${link.anchor}</a>`
@@ -117,7 +117,7 @@ export default class ComposerActionTitle extends Component {
const htmlLink = `<a class="user-link" href="${link.href}">${escape(
link.anchor
)}</a>`;
- return htmlSafe(`${avatar}${htmlLink}`);
+ return trustHTML(`${avatar}${htmlLink}`);
}
<template>
diff --git a/frontend/discourse/app/components/composer-container.gjs b/frontend/discourse/app/components/composer-container.gjs
index 53745741dfe..402964f6a24 100644
--- a/frontend/discourse/app/components/composer-container.gjs
+++ b/frontend/discourse/app/components/composer-container.gjs
@@ -5,7 +5,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { cancel } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ComposerActionTitle from "discourse/components/composer-action-title";
import ComposerBody from "discourse/components/composer-body";
import ComposerEditor from "discourse/components/composer-editor";
@@ -569,7 +569,7 @@ export default class ComposerContainer extends Component {
<div class="draft-text">
{{#if this.composer.model.topic}}
{{icon "share"}}
- {{htmlSafe this.composer.draftTitle}}
+ {{trustHTML this.composer.draftTitle}}
{{else}}
{{i18n "composer.saved_draft"}}
{{/if}}
diff --git a/frontend/discourse/app/components/composer-fullscreen-prompt.gjs b/frontend/discourse/app/components/composer-fullscreen-prompt.gjs
index 039bacfbcbf..ff4090b0258 100644
--- a/frontend/discourse/app/components/composer-fullscreen-prompt.gjs
+++ b/frontend/discourse/app/components/composer-fullscreen-prompt.gjs
@@ -1,5 +1,5 @@
import { on } from "@ember/modifier";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { i18n } from "discourse-i18n";
const ComposerFullscreenPrompt = <template>
@@ -7,7 +7,7 @@ const ComposerFullscreenPrompt = <template>
class="composer-fullscreen-prompt"
{{on "animationend" @removeFullScreenExitPrompt}}
>
- {{htmlSafe (i18n "composer.exit_fullscreen_prompt")}}
+ {{trustHTML (i18n "composer.exit_fullscreen_prompt")}}
</div>
</template>;
diff --git a/frontend/discourse/app/components/composer-messages/dominating-topic.gjs b/frontend/discourse/app/components/composer-messages/dominating-topic.gjs
index ee3ce167d4c..37425dde060 100644
--- a/frontend/discourse/app/components/composer-messages/dominating-topic.gjs
+++ b/frontend/discourse/app/components/composer-messages/dominating-topic.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { fn } from "@ember/helper";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ComposerTipCloseButton from "discourse/components/composer-tip-close-button";
import DButton from "discourse/components/d-button";
@@ -12,7 +12,7 @@ export default class DominatingTopicComposerMessage extends Component {
<ComposerTipCloseButton @action={{fn @closeMessage @message}} />
<div class="composer-popup__content">
- {{htmlSafe @message.body}}
+ {{trustHTML @message.body}}
{{#if this.currentUser.can_invite_to_forum}}
<DButton
diff --git a/frontend/discourse/app/components/composer-messages/education.gjs b/frontend/discourse/app/components/composer-messages/education.gjs
index e12284bb749..c300539999e 100644
--- a/frontend/discourse/app/components/composer-messages/education.gjs
+++ b/frontend/discourse/app/components/composer-messages/education.gjs
@@ -1,5 +1,5 @@
import { fn } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ComposerTipCloseButton from "discourse/components/composer-tip-close-button";
const EducationComposerMessage = <template>
@@ -10,7 +10,7 @@ const EducationComposerMessage = <template>
<h3>{{@message.title}}</h3>
{{/if}}
- {{htmlSafe @message.body}}
+ {{trustHTML @message.body}}
</div>
</template>;
diff --git a/frontend/discourse/app/components/composer-messages/get-a-room.gjs b/frontend/discourse/app/components/composer-messages/get-a-room.gjs
index e687459f5ae..dc25feabfab 100644
--- a/frontend/discourse/app/components/composer-messages/get-a-room.gjs
+++ b/frontend/discourse/app/components/composer-messages/get-a-room.gjs
@@ -1,5 +1,5 @@
import { fn } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ComposerTipCloseButton from "discourse/components/composer-tip-close-button";
import DButton from "discourse/components/d-button";
@@ -8,7 +8,7 @@ const GetARoomComposerMessage = <template>
<div class="composer-popup__content">
- {{htmlSafe @message.body}}
+ {{trustHTML @message.body}}
<DButton
@label="user.private_message"
diff --git a/frontend/discourse/app/components/composer-messages/group-mentioned.gjs b/frontend/discourse/app/components/composer-messages/group-mentioned.gjs
index eebd065c5c8..c706a1728ce 100644
--- a/frontend/discourse/app/components/composer-messages/group-mentioned.gjs
+++ b/frontend/discourse/app/components/composer-messages/group-mentioned.gjs
@@ -1,5 +1,5 @@
import { fn } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ComposerTipCloseButton from "discourse/components/composer-tip-close-button";
const GroupMentionedComposerMessage = <template>
@@ -7,7 +7,7 @@ const GroupMentionedComposerMessage = <template>
<div class="composer-popup__content">
<p>
- {{htmlSafe @message.body}}
+ {{trustHTML @message.body}}
</p>
</div>
</template>;
diff --git a/frontend/discourse/app/components/count-i18n.gjs b/frontend/discourse/app/components/count-i18n.gjs
index 6cfec7b2b80..04f355e2e00 100644
--- a/frontend/discourse/app/components/count-i18n.gjs
+++ b/frontend/discourse/app/components/count-i18n.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { i18n } from "discourse-i18n";
export default class CountI18n extends Component {
@@ -21,6 +21,6 @@ export default class CountI18n extends Component {
}
<template>
- <span>{{htmlSafe (i18n this.fullKey count=@count)}}</span>
+ <span>{{trustHTML (i18n this.fullKey count=@count)}}</span>
</template>
}
diff --git a/frontend/discourse/app/components/d-autocomplete-results.gjs b/frontend/discourse/app/components/d-autocomplete-results.gjs
index 027bfffab25..6210c594f49 100644
--- a/frontend/discourse/app/components/d-autocomplete-results.gjs
+++ b/frontend/discourse/app/components/d-autocomplete-results.gjs
@@ -3,7 +3,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
// CSS selectors for autocomplete result items
const RESULT_ITEM_SELECTOR = "li a";
@@ -129,14 +129,14 @@ export default class DAutocompleteResults extends Component {
const template = this.args.data.template({ options: this.results });
if (!this.isInitialRender || this.selectedIndex < 0) {
- return htmlSafe(template);
+ return trustHTML(template);
}
const tempDiv = document.createElement("div");
tempDiv.innerHTML = template;
this._applySelectedClass(tempDiv, this.selectedIndex);
- return htmlSafe(tempDiv.innerHTML);
+ return trustHTML(tempDiv.innerHTML);
}
get hasComponent() {
diff --git a/frontend/discourse/app/components/d-button.gjs b/frontend/discourse/app/components/d-button.gjs
index 6cace50e4bd..f53da26d849 100644
--- a/frontend/discourse/app/components/d-button.gjs
+++ b/frontend/discourse/app/components/d-button.gjs
@@ -5,7 +5,7 @@ import { action } from "@ember/object";
import { empty, equal, notEmpty } from "@ember/object/computed";
import { next } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
/** @type {import("discourse/helpers/element.gjs").default} */
@@ -102,7 +102,7 @@ export default class DButton extends Component {
get computedLabel() {
if (this.args.label) {
- return htmlSafe(i18n(this.args.label));
+ return trustHTML(i18n(this.args.label));
}
return this.args.translatedLabel;
}
diff --git a/frontend/discourse/app/components/d-editor-original-translation-preview.gjs b/frontend/discourse/app/components/d-editor-original-translation-preview.gjs
index 086fd67e036..4a221831a84 100644
--- a/frontend/discourse/app/components/d-editor-original-translation-preview.gjs
+++ b/frontend/discourse/app/components/d-editor-original-translation-preview.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import CookText from "discourse/components/cook-text";
import DToggleSwitch from "discourse/components/d-toggle-switch";
import { i18n } from "discourse-i18n";
@@ -86,7 +86,7 @@ export default class DEditorOriginalTranslationPreview extends Component {
{{/if}}
{{else}}
{{#if @model.cookedPost}}
- {{htmlSafe @model.cookedPost}}
+ {{trustHTML @model.cookedPost}}
{{else if @model.rawPost}}
<CookText @rawText={{@model.rawPost}} />
{{/if}}
diff --git a/frontend/discourse/app/components/d-editor-preview.gjs b/frontend/discourse/app/components/d-editor-preview.gjs
index be1954c58ee..80c89b265e5 100644
--- a/frontend/discourse/app/components/d-editor-preview.gjs
+++ b/frontend/discourse/app/components/d-editor-preview.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DecoratedHtml from "discourse/components/decorated-html";
import PluginOutlet from "discourse/components/plugin-outlet";
import { wantsNewWindow } from "discourse/lib/intercept-click";
@@ -48,7 +48,7 @@ export default class DEditorPreview extends Component {
>
<DecoratedHtml
@className="d-editor-preview"
- @html={{htmlSafe @preview}}
+ @html={{trustHTML @preview}}
@decorate={{@onPreviewUpdated}}
/>
<span class="d-editor-plugin">
diff --git a/frontend/discourse/app/components/d-multi-select.gjs b/frontend/discourse/app/components/d-multi-select.gjs
index b18c9c3d63f..4c084096b7b 100644
--- a/frontend/discourse/app/components/d-multi-select.gjs
+++ b/frontend/discourse/app/components/d-multi-select.gjs
@@ -5,7 +5,7 @@ import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { TrackedAsyncData } from "ember-async-data";
import DButton from "discourse/components/d-button";
import DropdownMenu from "discourse/components/dropdown-menu";
@@ -23,7 +23,7 @@ import { i18n } from "discourse-i18n";
class Skeleton extends Component {
get width() {
- return htmlSafe(`width: ${Math.floor(Math.random() * 70) + 20}%`);
+ return trustHTML(`width: ${Math.floor(Math.random() * 70) + 20}%`);
}
<template>
diff --git a/frontend/discourse/app/components/d-page-header.gjs b/frontend/discourse/app/components/d-page-header.gjs
index df687a366b3..5543ebfa75e 100644
--- a/frontend/discourse/app/components/d-page-header.gjs
+++ b/frontend/discourse/app/components/d-page-header.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { hash } from "@ember/helper";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DBreadcrumbsContainer from "discourse/components/d-breadcrumbs-container";
import {
DangerActionListItem,
@@ -143,9 +143,9 @@ export default class DPageHeader extends Component {
{{#if @descriptionLabel}}
<p class="d-page-header__description">
- {{htmlSafe @descriptionLabel}}
+ {{trustHTML @descriptionLabel}}
{{#if @learnMoreUrl}}
- <span class="d-page-header__learn-more">{{htmlSafe
+ <span class="d-page-header__learn-more">{{trustHTML
(i18n "learn_more_with_link" url=@learnMoreUrl)
}}</span>
{{/if}}
diff --git a/frontend/discourse/app/components/d-page-subheader.gjs b/frontend/discourse/app/components/d-page-subheader.gjs
index 13e049a8a22..7a56756ad40 100644
--- a/frontend/discourse/app/components/d-page-subheader.gjs
+++ b/frontend/discourse/app/components/d-page-subheader.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { hash } from "@ember/helper";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import {
DangerActionListItem,
DangerButton,
@@ -72,10 +72,10 @@ export default class DPageSubheader extends Component {
{{#if @descriptionLabel}}
<p class="d-page-subheader__description">
- {{htmlSafe @descriptionLabel}}
+ {{trustHTML @descriptionLabel}}
{{#if @learnMoreUrl}}
<span class="d-page-subheader__learn-more">
- {{htmlSafe
+ {{trustHTML
(i18n "learn_more_with_link" url=@learnMoreUrl)
}}</span>
{{/if}}
diff --git a/frontend/discourse/app/components/decorated-html.gjs b/frontend/discourse/app/components/decorated-html.gjs
index 9b60d601249..d02efba8848 100644
--- a/frontend/discourse/app/components/decorated-html.gjs
+++ b/frontend/discourse/app/components/decorated-html.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { untrack } from "@glimmer/validator";
-import { htmlSafe, isHTMLSafe } from "@ember/template";
+import { isHTMLSafe, trustHTML } from "@ember/template";
import { TrackedArray } from "@ember-compat/tracked-built-ins";
import helperFn from "discourse/helpers/helper-fn";
import deprecated from "discourse/lib/deprecated";
@@ -157,7 +157,7 @@ export default class DecoratedHtml extends Component {
});
get elementToDecorate() {
- const cooked = this.args.html || htmlSafe("");
+ const cooked = this.args.html || trustHTML("");
if (!isHTMLSafe(cooked)) {
throw "@html must be an htmlSafe string";
}
diff --git a/frontend/discourse/app/components/dialog-messages/second-factor-confirm-phrase.gjs b/frontend/discourse/app/components/dialog-messages/second-factor-confirm-phrase.gjs
index b738c4e76d3..3e5eb2b8629 100644
--- a/frontend/discourse/app/components/dialog-messages/second-factor-confirm-phrase.gjs
+++ b/frontend/discourse/app/components/dialog-messages/second-factor-confirm-phrase.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import TextField from "discourse/components/text-field";
import { i18n } from "discourse-i18n";
@@ -39,7 +39,7 @@ export default class SecondFactorConfirmPhrase extends Component {
</ul>
<p>
- {{htmlSafe
+ {{trustHTML
(i18n
"user.second_factor.delete_confirm_instruction"
confirm=this.disabledString
diff --git a/frontend/discourse/app/components/discourse-banner.gjs b/frontend/discourse/app/components/discourse-banner.gjs
index ed22cefdb51..427a9fefd16 100644
--- a/frontend/discourse/app/components/discourse-banner.gjs
+++ b/frontend/discourse/app/components/discourse-banner.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
@@ -26,7 +26,7 @@ export default class DiscourseBanner extends Component {
newDiv.querySelectorAll("[id^='heading--']").forEach((el) => {
el.removeAttribute("id");
});
- return htmlSafe(newDiv.innerHTML);
+ return trustHTML(newDiv.innerHTML);
}
get visible() {
@@ -72,7 +72,7 @@ export default class DiscourseBanner extends Component {
>
{{icon "pencil"}}
{{#if this.site.desktopView}}
- {{htmlSafe (i18n "banner.edit")}}
+ {{trustHTML (i18n "banner.edit")}}
{{/if}}
</a>
{{/if}}
diff --git a/frontend/discourse/app/components/discourse-linked-text.gjs b/frontend/discourse/app/components/discourse-linked-text.gjs
index 93fd74ccb99..e2594967b0e 100644
--- a/frontend/discourse/app/components/discourse-linked-text.gjs
+++ b/frontend/discourse/app/components/discourse-linked-text.gjs
@@ -1,7 +1,7 @@
/* eslint-disable ember/no-classic-components, ember/require-tagless-components */
import Component from "@ember/component";
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { i18n } from "discourse-i18n";
@@ -22,5 +22,5 @@ export default class DiscourseLinkedText extends Component {
return false;
}
- <template>{{htmlSafe this.translatedText}}</template>
+ <template>{{trustHTML this.translatedText}}</template>
}
diff --git a/frontend/discourse/app/components/discovery/navigation.gjs b/frontend/discourse/app/components/discovery/navigation.gjs
index b3020758c5b..74143bd53e4 100644
--- a/frontend/discourse/app/components/discovery/navigation.gjs
+++ b/frontend/discourse/app/components/discovery/navigation.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { array } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AddCategoryTagClasses from "discourse/components/add-category-tag-classes";
import CategoryLogo from "discourse/components/category-logo";
import DNavigation from "discourse/components/d-navigation";
@@ -108,7 +108,7 @@ export default class DiscoveryNavigation extends Component {
<div class="category-heading__content">
{{categoryBadge @category class="category-heading__badge"}}
<p class="category-heading__description">
- {{htmlSafe @category.description}}
+ {{trustHTML @category.description}}
</p>
</div>
{{/if}}
diff --git a/frontend/discourse/app/components/empty-topic-filter.gjs b/frontend/discourse/app/components/empty-topic-filter.gjs
index 6f5312d5bb9..b5bc01c4476 100644
--- a/frontend/discourse/app/components/empty-topic-filter.gjs
+++ b/frontend/discourse/app/components/empty-topic-filter.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import EmptyState from "discourse/components/empty-state";
import SvgDocumentsCheckmark from "discourse/components/svg/documents-checkmark";
import basePath from "discourse/helpers/base-path";
@@ -79,7 +79,7 @@ export default class EmptyTopicFilter extends Component {
@ctaRoute={{this.ctaRoute}}
@ctaAction={{this.ctaLabelWithAction.action}}
@tipIcon="circle-info"
- @tipText={{htmlSafe this.tipText}}
+ @tipText={{trustHTML this.tipText}}
@svgContent={{SvgDocumentsCheckmark}}
/>
</template>
diff --git a/frontend/discourse/app/components/featured-topic.gjs b/frontend/discourse/app/components/featured-topic.gjs
index e520d465a3a..46b3f416ae4 100644
--- a/frontend/discourse/app/components/featured-topic.gjs
+++ b/frontend/discourse/app/components/featured-topic.gjs
@@ -1,6 +1,6 @@
/* eslint-disable ember/no-classic-components, ember/no-jquery, ember/require-tagless-components */
import Component from "@ember/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import {
attributeBindings,
classNameBindings,
@@ -25,7 +25,7 @@ export default class FeaturedTopic extends Component {
<template>
<TopicStatus @topic={{this.topic}} @disableActions={{true}} />
- <a href={{this.topic.lastUnreadUrl}} class="title">{{htmlSafe
+ <a href={{this.topic.lastUnreadUrl}} class="title">{{trustHTML
this.topic.fancyTitle
}}</a>
<TopicPostBadges
diff --git a/frontend/discourse/app/components/flag-action-type.gjs b/frontend/discourse/app/components/flag-action-type.gjs
index e736448aaae..486cab82e2d 100644
--- a/frontend/discourse/app/components/flag-action-type.gjs
+++ b/frontend/discourse/app/components/flag-action-type.gjs
@@ -4,7 +4,7 @@ import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { computed } from "@ember/object";
import { and, equal } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import concatClass from "discourse/helpers/concat-class";
import { applyValueTransformer } from "discourse/lib/transformer";
@@ -106,7 +106,9 @@ export default class FlagActionType extends Component {
/>
<div class="flag-action-type-details">
- <span class="description">{{htmlSafe this.flagDescription}}</span>
+ <span class="description">{{trustHTML
+ this.flagDescription
+ }}</span>
{{#if this.showMessageInput}}
<Textarea
name="message"
@@ -143,7 +145,7 @@ export default class FlagActionType extends Component {
/>
<div class="flag-action-type-details">
<strong class="flag-name">{{this.formattedName}}</strong>
- <div class="description">{{htmlSafe this.flagDescription}}</div>
+ <div class="description">{{trustHTML this.flagDescription}}</div>
{{#if this.showMessageInput}}
<Textarea
name="message"
diff --git a/frontend/discourse/app/components/form-template-field/checkbox.gjs b/frontend/discourse/app/components/form-template-field/checkbox.gjs
index e42312a11bb..633d6e7a29f 100644
--- a/frontend/discourse/app/components/form-template-field/checkbox.gjs
+++ b/frontend/discourse/app/components/form-template-field/checkbox.gjs
@@ -1,6 +1,6 @@
import { Input } from "@ember/component";
import { on } from "@ember/modifier";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
const Checkbox = <template>
@@ -22,7 +22,7 @@ const Checkbox = <template>
{{#if @attributes.description}}
<span class="form-template-field__description">
- {{htmlSafe @attributes.description}}
+ {{trustHTML @attributes.description}}
</span>
{{/if}}
</div>
diff --git a/frontend/discourse/app/components/form-template-field/composer.gjs b/frontend/discourse/app/components/form-template-field/composer.gjs
index f50767e2260..2fd2b122af4 100644
--- a/frontend/discourse/app/components/form-template-field/composer.gjs
+++ b/frontend/discourse/app/components/form-template-field/composer.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { next } from "@ember/runloop";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DEditor from "discourse/components/d-editor";
import icon from "discourse/helpers/d-icon";
@@ -30,7 +30,7 @@ export default class FormTemplateFieldComposer extends Component {
{{#if @attributes.description}}
<span class="form-template-field__description">
- {{htmlSafe @attributes.description}}
+ {{trustHTML @attributes.description}}
</span>
{{/if}}
<input type="hidden" name={{@id}} value={{this.composerValue}} />
diff --git a/frontend/discourse/app/components/form-template-field/dropdown.gjs b/frontend/discourse/app/components/form-template-field/dropdown.gjs
index 1f7989e2cf9..9cf314295f0 100644
--- a/frontend/discourse/app/components/form-template-field/dropdown.gjs
+++ b/frontend/discourse/app/components/form-template-field/dropdown.gjs
@@ -1,5 +1,5 @@
import { on } from "@ember/modifier";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
import { eq } from "discourse/truth-helpers";
@@ -16,7 +16,7 @@ const Dropdown = <template>
{{#if @attributes.description}}
<span class="form-template-field__description">
- {{htmlSafe @attributes.description}}
+ {{trustHTML @attributes.description}}
</span>
{{/if}}
diff --git a/frontend/discourse/app/components/form-template-field/input.gjs b/frontend/discourse/app/components/form-template-field/input.gjs
index 201adb96e1a..f0430cfb80f 100644
--- a/frontend/discourse/app/components/form-template-field/input.gjs
+++ b/frontend/discourse/app/components/form-template-field/input.gjs
@@ -1,6 +1,6 @@
import { Input } from "@ember/component";
import { on } from "@ember/modifier";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
const FormTemplateFieldInput = <template>
@@ -16,7 +16,7 @@ const FormTemplateFieldInput = <template>
{{#if @attributes.description}}
<span class="form-template-field__description">
- {{htmlSafe @attributes.description}}
+ {{trustHTML @attributes.description}}
</span>
{{/if}}
diff --git a/frontend/discourse/app/components/form-template-field/multi-select.gjs b/frontend/discourse/app/components/form-template-field/multi-select.gjs
index 82080d27449..4445ef2857d 100644
--- a/frontend/discourse/app/components/form-template-field/multi-select.gjs
+++ b/frontend/discourse/app/components/form-template-field/multi-select.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
export default class FormTemplateFieldMultiSelect extends Component {
@@ -26,7 +26,7 @@ export default class FormTemplateFieldMultiSelect extends Component {
{{#if @attributes.description}}
<span class="form-template-field__description">
- {{htmlSafe @attributes.description}}
+ {{trustHTML @attributes.description}}
</span>
{{/if}}
diff --git a/frontend/discourse/app/components/form-template-field/tag-chooser.gjs b/frontend/discourse/app/components/form-template-field/tag-chooser.gjs
index c5059d6940c..4eb2e9ca4a4 100644
--- a/frontend/discourse/app/components/form-template-field/tag-chooser.gjs
+++ b/frontend/discourse/app/components/form-template-field/tag-chooser.gjs
@@ -5,7 +5,7 @@ import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
import { next } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
import { uniqueItemsFromArray } from "discourse/lib/array-tools";
import { not } from "discourse/truth-helpers";
@@ -168,7 +168,7 @@ export default class TagChooserField extends Component {
{{#if @attributes.description}}
<span class="form-template-field__description">
- {{htmlSafe @attributes.description}}
+ {{trustHTML @attributes.description}}
</span>
{{/if}}
diff --git a/frontend/discourse/app/components/form-template-field/textarea.gjs b/frontend/discourse/app/components/form-template-field/textarea.gjs
index ac3720804bb..67e267a037d 100644
--- a/frontend/discourse/app/components/form-template-field/textarea.gjs
+++ b/frontend/discourse/app/components/form-template-field/textarea.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { schedule } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
import { resettableTracked } from "discourse/lib/tracked-tools";
@@ -55,7 +55,7 @@ export default class FormTemplateFieldTextarea extends Component {
{{#if @attributes.description}}
<span class="form-template-field__description">
- {{htmlSafe @attributes.description}}
+ {{trustHTML @attributes.description}}
</span>
{{/if}}
diff --git a/frontend/discourse/app/components/form-template-field/upload.gjs b/frontend/discourse/app/components/form-template-field/upload.gjs
index 806de40734a..054ca77fa4f 100644
--- a/frontend/discourse/app/components/form-template-field/upload.gjs
+++ b/frontend/discourse/app/components/form-template-field/upload.gjs
@@ -4,7 +4,7 @@ import { getOwner } from "@ember/owner";
import { next, schedule } from "@ember/runloop";
import { service } from "@ember/service";
import { dasherize } from "@ember/string";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PickFilesButton from "discourse/components/pick-files-button";
import icon from "discourse/helpers/d-icon";
import { bind } from "discourse/lib/decorators";
@@ -142,7 +142,7 @@ export default class FormTemplateFieldUpload extends Component {
{{#if @attributes.description}}
<span class="form-template-field__description">
- {{htmlSafe @attributes.description}}
+ {{trustHTML @attributes.description}}
</span>
{{/if}}
diff --git a/frontend/discourse/app/components/global-notice.gjs b/frontend/discourse/app/components/global-notice.gjs
index f90e3a1b55f..f5f49b94661 100644
--- a/frontend/discourse/app/components/global-notice.gjs
+++ b/frontend/discourse/app/components/global-notice.gjs
@@ -3,7 +3,7 @@ import Component from "@ember/component";
import { fn } from "@ember/helper";
import EmberObject, { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import DButton from "discourse/components/d-button";
import cookie, { removeCookie } from "discourse/lib/cookie";
@@ -244,7 +244,7 @@ export default class GlobalNotice extends Component {
@bind
_handleLogsNoticeUpdate() {
const logNotice = Notice.create({
- text: htmlSafe(this.logsNoticeService.message),
+ text: trustHTML(this.logsNoticeService.message),
id: "alert-logs-notice",
options: {
dismissable: true,
@@ -267,10 +267,10 @@ export default class GlobalNotice extends Component {
class="alert alert-{{notice.options.level}} {{notice.id}}"
>
{{#if notice.options.html}}
- {{htmlSafe notice.options.html}}
+ {{trustHTML notice.options.html}}
{{/if}}
- <span class="text">{{htmlSafe notice.text}}</span>
+ <span class="text">{{trustHTML notice.text}}</span>
{{#if notice.options.dismissable}}
<DButton
diff --git a/frontend/discourse/app/components/group-card-contents.gjs b/frontend/discourse/app/components/group-card-contents.gjs
index 7833dd0accc..9fc645c9cce 100644
--- a/frontend/discourse/app/components/group-card-contents.gjs
+++ b/frontend/discourse/app/components/group-card-contents.gjs
@@ -2,7 +2,7 @@ import { on } from "@ember/modifier";
import { action, computed } from "@ember/object";
import { alias, gt } from "@ember/object/computed";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNameBindings, classNames } from "@ember-decorators/component";
import { on as onEvent } from "@ember-decorators/object";
import AvatarFlair from "discourse/components/avatar-flair";
@@ -205,7 +205,7 @@ export default class GroupCardContents extends CardContentsBase {
{{#if this.group.bio_excerpt}}
<div class="card-row second-row">
<div class="bio">
- {{htmlSafe this.group.bio_excerpt}}
+ {{trustHTML this.group.bio_excerpt}}
</div>
</div>
{{/if}}
diff --git a/frontend/discourse/app/components/group-card.gjs b/frontend/discourse/app/components/group-card.gjs
index 11f139b303d..981deb82b0d 100644
--- a/frontend/discourse/app/components/group-card.gjs
+++ b/frontend/discourse/app/components/group-card.gjs
@@ -1,5 +1,5 @@
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AvatarFlair from "discourse/components/avatar-flair";
import GroupInfo from "discourse/components/group-info";
import GroupMembershipButton from "discourse/components/group-membership-button";
@@ -37,7 +37,7 @@ const GroupCard = <template>
</span>
</div>
- <div class="group-description">{{htmlSafe @group.bio_excerpt}}</div>
+ <div class="group-description">{{trustHTML @group.bio_excerpt}}</div>
<div class="group-membership">
<GroupMembershipButton
diff --git a/frontend/discourse/app/components/header/topic/info.gjs b/frontend/discourse/app/components/header/topic/info.gjs
index 7c513f86a7e..e3024630871 100644
--- a/frontend/discourse/app/components/header/topic/info.gjs
+++ b/frontend/discourse/app/components/header/topic/info.gjs
@@ -3,7 +3,7 @@ import { hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import TopicStatus from "discourse/components/topic-status";
import categoryLink from "discourse/helpers/category-link";
import concatClass from "discourse/helpers/concat-class";
@@ -118,7 +118,7 @@ export default class Info extends Component {
href={{@topicInfo.url}}
data-topic-id={{@topicInfo.id}}
>
- <span>{{htmlSafe @topicInfo.fancyTitle}}</span>
+ <span>{{trustHTML @topicInfo.fancyTitle}}</span>
</a>
<span class="header-topic-title-suffix">
@@ -169,7 +169,7 @@ export default class Info extends Component {
{{/if}}
<div class="topic-header-extra">
- {{htmlSafe this.tags}}
+ {{trustHTML this.tags}}
{{#if this.showPM}}
<div class="topic-header-participants">
{{#each this.participants as |participant|}}
diff --git a/frontend/discourse/app/components/header/user-dropdown/notifications.gjs b/frontend/discourse/app/components/header/user-dropdown/notifications.gjs
index 99ce2cdffc5..ff96852ffad 100644
--- a/frontend/discourse/app/components/header/user-dropdown/notifications.gjs
+++ b/frontend/discourse/app/components/header/user-dropdown/notifications.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { hash } from "@ember/helper";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import icon from "discourse/helpers/d-icon";
import {
@@ -21,7 +21,7 @@ export default class Notifications extends Component {
get avatar() {
const avatarAttrs = addExtraUserClasses(this.currentUser, {});
- return htmlSafe(
+ return trustHTML(
renderAvatar(this.currentUser, {
imageSize: this.avatarSize,
hideTitle: true,
diff --git a/frontend/discourse/app/components/image-carousel.gjs b/frontend/discourse/app/components/image-carousel.gjs
index 42b780de98c..c4eab4c88e7 100644
--- a/frontend/discourse/app/components/image-carousel.gjs
+++ b/frontend/discourse/app/components/image-carousel.gjs
@@ -5,7 +5,7 @@ import { concat, fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { throttle } from "@ember/runloop";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
@@ -17,7 +17,7 @@ const plusOne = helper(([val]) => val + 1);
const getAspectRatio = helper(([width, height]) => {
const w = parseInt(width, 10) || 1;
const h = parseInt(height, 10) || 1;
- return htmlSafe(`aspect-ratio: ${w} / ${h}`);
+ return trustHTML(`aspect-ratio: ${w} / ${h}`);
});
const KEYBOARD_THROTTLE_MS = isTesting() ? 0 : 150;
diff --git a/frontend/discourse/app/components/invite-panel.gjs b/frontend/discourse/app/components/invite-panel.gjs
index 9af05897958..076562c7453 100644
--- a/frontend/discourse/app/components/invite-panel.gjs
+++ b/frontend/discourse/app/components/invite-panel.gjs
@@ -4,7 +4,7 @@ import { fn, hash } from "@ember/helper";
import EmberObject, { action, computed } from "@ember/object";
import { alias, and, equal, readOnly } from "@ember/object/computed";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { tagName } from "@ember-decorators/component";
import DButton from "discourse/components/d-button";
@@ -452,7 +452,7 @@ export default class InvitePanel extends Component {
<div ...attributes>
{{#if this.inviteModel.error}}
<div class="alert alert-error">
- {{htmlSafe this.errorMessage}}
+ {{trustHTML this.errorMessage}}
</div>
{{/if}}
diff --git a/frontend/discourse/app/components/local-login-form.gjs b/frontend/discourse/app/components/local-login-form.gjs
index 86e90f3af73..65884e5e9d1 100644
--- a/frontend/discourse/app/components/local-login-form.gjs
+++ b/frontend/discourse/app/components/local-login-form.gjs
@@ -6,7 +6,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import ForgotPassword from "discourse/components/modal/forgot-password";
import PasswordField from "discourse/components/password-field";
@@ -91,7 +91,7 @@ export default class LocalLoginForm extends Component {
: "email_login.complete_username";
if (data.user_found === false) {
this.args.flashChanged(
- htmlSafe(
+ trustHTML(
i18n(`${key}_not_found`, {
email: loginName,
username: loginName,
@@ -102,7 +102,7 @@ export default class LocalLoginForm extends Component {
} else {
const postfix = data.hide_taken ? "" : "_found";
this.args.flashChanged(
- htmlSafe(
+ trustHTML(
i18n(`${key}${postfix}`, {
email: loginName,
username: loginName,
diff --git a/frontend/discourse/app/components/mobile-nav.gjs b/frontend/discourse/app/components/mobile-nav.gjs
index ff023720ffb..8e9955d3be3 100644
--- a/frontend/discourse/app/components/mobile-nav.gjs
+++ b/frontend/discourse/app/components/mobile-nav.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { next } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNames, tagName } from "@ember-decorators/component";
import { on as onEvent } from "@ember-decorators/object";
import $ from "jquery";
@@ -85,7 +85,7 @@ export default class MobileNav extends Component {
{{#if this.selectedHtml}}
<li>
<a href {{on "click" this.toggleExpanded}} class="expander">
- <span class="selection">{{htmlSafe this.selectedHtml}}</span>
+ <span class="selection">{{trustHTML this.selectedHtml}}</span>
{{icon "angle-down"}}
</a>
</li>
diff --git a/frontend/discourse/app/components/modal/activation-resent.gjs b/frontend/discourse/app/components/modal/activation-resent.gjs
index e28d6ac3792..515fc196720 100644
--- a/frontend/discourse/app/components/modal/activation-resent.gjs
+++ b/frontend/discourse/app/components/modal/activation-resent.gjs
@@ -1,11 +1,11 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n";
const ActivationResent = <template>
<DModal @title={{i18n "log_in"}} @closeModal={{@closeModal}}>
<:body>
- {{htmlSafe
+ {{trustHTML
(i18n
"login.sent_activation_email_again" [email protected]
)
diff --git a/frontend/discourse/app/components/modal/anonymous-flag.gjs b/frontend/discourse/app/components/modal/anonymous-flag.gjs
index 5bd69f9c1fd..b003def543f 100644
--- a/frontend/discourse/app/components/modal/anonymous-flag.gjs
+++ b/frontend/discourse/app/components/modal/anonymous-flag.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import DModal from "discourse/components/d-modal";
import { getAbsoluteURL } from "discourse/lib/get-url";
@@ -32,8 +32,8 @@ export default class AnonymousFlagModal extends Component {
class="anonymous-flag-modal"
>
<:body>
- <p>{{htmlSafe (i18n "flagging.review_process_description")}}</p>
- <p>{{htmlSafe this.description}}</p>
+ <p>{{trustHTML (i18n "flagging.review_process_description")}}</p>
+ <p>{{trustHTML this.description}}</p>
</:body>
</DModal>
</template>
diff --git a/frontend/discourse/app/components/modal/auth-token.gjs b/frontend/discourse/app/components/modal/auth-token.gjs
index 2d72f009cd6..9033e2a0951 100644
--- a/frontend/discourse/app/components/modal/auth-token.gjs
+++ b/frontend/discourse/app/components/modal/auth-token.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import DModalCancel from "discourse/components/d-modal-cancel";
@@ -49,7 +49,7 @@ export default class AuthTokenComponent extends Component {
<:body>
<div>
<p>{{i18n "user.auth_tokens.was_this_you_description"}}</p>
- <p>{{htmlSafe (i18n "user.second_factor.extended_description")}}</p>
+ <p>{{trustHTML (i18n "user.second_factor.extended_description")}}</p>
</div>
<div>
<h3>{{i18n "user.auth_tokens.details"}}</h3>
@@ -76,9 +76,9 @@ export default class AuthTokenComponent extends Component {
</a>
</h3>
{{#if this.expanded}}
- <blockquote>{{htmlSafe this.latestPost.cooked}}</blockquote>
+ <blockquote>{{trustHTML this.latestPost.cooked}}</blockquote>
{{else}}
- <blockquote>{{htmlSafe this.latestPost.excerpt}}</blockquote>
+ <blockquote>{{trustHTML this.latestPost.excerpt}}</blockquote>
{{/if}}
</div>
{{/if}}
diff --git a/frontend/discourse/app/components/modal/avatar-selector.gjs b/frontend/discourse/app/components/modal/avatar-selector.gjs
index 365cc825a40..9bd5428401c 100644
--- a/frontend/discourse/app/components/modal/avatar-selector.gjs
+++ b/frontend/discourse/app/components/modal/avatar-selector.gjs
@@ -4,7 +4,7 @@ import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AvatarUploader from "discourse/components/avatar-uploader";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -241,7 +241,7 @@ export default class AvatarSelectorModal extends Component {
"large"
}}
<span>
- {{htmlSafe
+ {{trustHTML
(i18n
"user.change_avatar.gravatar"
gravatarName=this.siteSettings.gravatar_name
diff --git a/frontend/discourse/app/components/modal/bookmark.gjs b/frontend/discourse/app/components/modal/bookmark.gjs
index 47f5d4dbcb9..25f609fe557 100644
--- a/frontend/discourse/app/components/modal/bookmark.gjs
+++ b/frontend/discourse/app/components/modal/bookmark.gjs
@@ -6,7 +6,7 @@ import { action } from "@ember/object";
import { and, notEmpty } from "@ember/object/computed";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ItsATrap from "@discourse/itsatrap";
import { Promise } from "rsvp";
import DButton from "discourse/components/d-button";
@@ -431,7 +431,7 @@ export default class BookmarkModal extends Component {
@_itsatrap={{this._itsatrap}}
/>
{{else}}
- <div class="alert alert-info">{{htmlSafe
+ <div class="alert alert-info">{{trustHTML
(i18n "bookmarks.no_timezone" basePath=(basePath))
}}</div>
{{/if}}
diff --git a/frontend/discourse/app/components/modal/bulk-topic-actions.gjs b/frontend/discourse/app/components/modal/bulk-topic-actions.gjs
index 1a15d56102d..dd96427730b 100644
--- a/frontend/discourse/app/components/modal/bulk-topic-actions.gjs
+++ b/frontend/discourse/app/components/modal/bulk-topic-actions.gjs
@@ -5,7 +5,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { getOwner } from "@ember/owner";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { Promise } from "rsvp";
import ConditionalLoadingSection from "discourse/components/conditional-loading-section";
import DButton from "discourse/components/d-button";
@@ -419,20 +419,20 @@ export default class BulkTopicActions extends Component {
{{#if this.failureMessages}}
<div class="topic-bulk-actions-modal__errors">
{{#if this.successTopicCount}}
- <p>{{htmlSafe
+ <p>{{trustHTML
(i18n
"topics.bulk.completed_count" count=this.successTopicCount
)
}}</p>
{{/if}}
{{#if this.skippedTopicCount}}
- <p>{{htmlSafe
+ <p>{{trustHTML
(i18n
"topics.bulk.skipped_count" count=this.skippedTopicCount
)
}}</p>
{{/if}}
- <p>{{htmlSafe
+ <p>{{trustHTML
(i18n "topics.bulk.not_completed" count=this.failedTopicCount)
}}</p>
<ul>
@@ -449,15 +449,15 @@ export default class BulkTopicActions extends Component {
<div class="topic-bulk-actions-modal__selection-info">
{{#if this.showSoleCategoryTip}}
- {{htmlSafe
+ {{trustHTML
(i18n
"topics.bulk.selected_sole_category"
)
}}
- {{htmlSafe this.soleCategoryBadgeHTML}}
+ {{trustHTML this.soleCategoryBadgeHTML}}
{{else}}
- {{htmlSafe
+ {{trustHTML
(i18n
"topics.bulk.selected"
@@ -489,7 +489,7 @@ export default class BulkTopicActions extends Component {
@selection={{this.notificationLevelId}}
/>
<strong>{{level.name}}</strong>
- <div class="description">{{htmlSafe
+ <div class="description">{{trustHTML
level.description
}}</div>
</label>
diff --git a/frontend/discourse/app/components/modal/change-owner.gjs b/frontend/discourse/app/components/modal/change-owner.gjs
index aa1033b3b11..de3ec31b29e 100644
--- a/frontend/discourse/app/components/modal/change-owner.gjs
+++ b/frontend/discourse/app/components/modal/change-owner.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -74,7 +74,7 @@ export default class ChangeOwnerModal extends Component {
>
<:body>
<span>
- {{htmlSafe
+ {{trustHTML
(i18n
(if
this.selectedPostsUsername
diff --git a/frontend/discourse/app/components/modal/create-invite-bulk.gjs b/frontend/discourse/app/components/modal/create-invite-bulk.gjs
index 8d0c2cd6f6c..d2986768e20 100644
--- a/frontend/discourse/app/components/modal/create-invite-bulk.gjs
+++ b/frontend/discourse/app/components/modal/create-invite-bulk.gjs
@@ -1,5 +1,5 @@
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import CreateInviteUploader from "discourse/components/create-invite-uploader";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -16,7 +16,7 @@ const CreateInviteBulk = <template>
{{#if uploader.uploaded}}
{{i18n "user.invited.bulk_invite.success"}}
{{else}}
- {{htmlSafe (i18n "user.invited.bulk_invite.instructions")}}
+ {{trustHTML (i18n "user.invited.bulk_invite.instructions")}}
<input
id="csv-file"
disabled={{uploader.uploading}}
diff --git a/frontend/discourse/app/components/modal/create-invite.gjs b/frontend/discourse/app/components/modal/create-invite.gjs
index 7d8d9710b8c..c92f3351d03 100644
--- a/frontend/discourse/app/components/modal/create-invite.gjs
+++ b/frontend/discourse/app/components/modal/create-invite.gjs
@@ -4,7 +4,7 @@ import { fn, hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import CopyButton from "discourse/components/copy-button";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -309,7 +309,7 @@ export default class CreateInvite extends Component {
}}
>
{{#if this.flashText}}
- {{htmlSafe this.flashText}}
+ {{trustHTML this.flashText}}
{{else}}
{{i18n "user.invited.invite.copy_link_and_share_it"}}
{{/if}}
diff --git a/frontend/discourse/app/components/modal/delete-topic-disallowed.gjs b/frontend/discourse/app/components/modal/delete-topic-disallowed.gjs
index 6b1b9e72709..4b19aa13187 100644
--- a/frontend/discourse/app/components/modal/delete-topic-disallowed.gjs
+++ b/frontend/discourse/app/components/modal/delete-topic-disallowed.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n";
@@ -6,7 +6,7 @@ import { i18n } from "discourse-i18n";
const DeleteTopicDisallowed = <template>
<DModal @closeModal={{@closeModal}}>
<:body>
- <p>{{htmlSafe (i18n "post.controls.delete_topic_disallowed_modal")}}</p>
+ <p>{{trustHTML (i18n "post.controls.delete_topic_disallowed_modal")}}</p>
</:body>
<:footer>
<DButton @action={{@closeModal}} class="btn-primary" @label="close" />
diff --git a/frontend/discourse/app/components/modal/feature-topic.gjs b/frontend/discourse/app/components/modal/feature-topic.gjs
index 53df0a3fd1f..7f79c98c228 100644
--- a/frontend/discourse/app/components/modal/feature-topic.gjs
+++ b/frontend/discourse/app/components/modal/feature-topic.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { fn } from "@ember/helper";
import EmberObject, { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -203,14 +203,14 @@ export default class FeatureTopic extends Component {
@condition={{this.loading}}
>
{{#if this.pinnedGloballyCount}}
- {{htmlSafe
+ {{trustHTML
(i18n
"topic.feature_topic.already_pinned_globally"
count=this.pinnedGloballyCount
)
}}
{{else}}
- {{htmlSafe
+ {{trustHTML
(i18n "topic.feature_topic.not_pinned_globally")
}}
{{/if}}
@@ -223,12 +223,12 @@ export default class FeatureTopic extends Component {
@size="small"
@condition={{this.loading}}
>
- {{htmlSafe this.alreadyPinnedMessage}}
+ {{trustHTML this.alreadyPinnedMessage}}
</ConditionalLoadingSpinner>
</p>
<p>{{i18n "topic.feature_topic.pin_note"}}</p>
{{/if}}
- <p>{{htmlSafe this.unPinMessage}}</p>
+ <p>{{trustHTML this.unPinMessage}}</p>
<p><DButton
@action={{this.unpin}}
@icon="thumbtack"
@@ -245,7 +245,7 @@ export default class FeatureTopic extends Component {
@size="small"
@condition={{this.loading}}
>
- {{htmlSafe this.alreadyPinnedMessage}}
+ {{trustHTML this.alreadyPinnedMessage}}
</ConditionalLoadingSpinner>
</p>
<p>
@@ -253,7 +253,7 @@ export default class FeatureTopic extends Component {
</p>
{{#if this.site.mobileView}}
<p>
- {{htmlSafe this.pinMessage}}
+ {{trustHTML this.pinMessage}}
</p>
<p class="with-validation">
<FutureDateInput
@@ -271,7 +271,7 @@ export default class FeatureTopic extends Component {
</p>
{{else}}
<p class="with-validation">
- {{htmlSafe this.pinMessage}}
+ {{trustHTML this.pinMessage}}
<span>
{{icon "far-clock"}}
<FutureDateInput
@@ -309,14 +309,14 @@ export default class FeatureTopic extends Component {
@condition={{this.loading}}
>
{{#if this.pinnedGloballyCount}}
- {{htmlSafe
+ {{trustHTML
(i18n
"topic.feature_topic.already_pinned_globally"
count=this.pinnedGloballyCount
)
}}
{{else}}
- {{htmlSafe
+ {{trustHTML
(i18n "topic.feature_topic.not_pinned_globally")
}}
{{/if}}
@@ -385,9 +385,9 @@ export default class FeatureTopic extends Component {
@condition={{this.loading}}
>
{{#if this.bannerCount}}
- {{htmlSafe (i18n "topic.feature_topic.banner_exists")}}
+ {{trustHTML (i18n "topic.feature_topic.banner_exists")}}
{{else}}
- {{htmlSafe (i18n "topic.feature_topic.no_banner_exists")}}
+ {{trustHTML (i18n "topic.feature_topic.no_banner_exists")}}
{{/if}}
</ConditionalLoadingSpinner>
</p>
diff --git a/frontend/discourse/app/components/modal/flag.gjs b/frontend/discourse/app/components/modal/flag.gjs
index 4b8d6188ef7..f55d57e8d94 100644
--- a/frontend/discourse/app/components/modal/flag.gjs
+++ b/frontend/discourse/app/components/modal/flag.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import FlagActionType from "discourse/components/flag-action-type";
@@ -237,7 +237,7 @@ export default class Flag extends Component {
{{on "keydown" this.onKeydown}}
>
<:body>
- <p>{{htmlSafe (i18n "flagging.review_process_description")}}</p>
+ <p>{{trustHTML (i18n "flagging.review_process_description")}}</p>
<PluginOutlet
@name="after-flag-modal-review-process-description"
@connectorTagName="div"
diff --git a/frontend/discourse/app/components/modal/forgot-password.gjs b/frontend/discourse/app/components/modal/forgot-password.gjs
index b83b528928b..c933210af05 100644
--- a/frontend/discourse/app/components/modal/forgot-password.gjs
+++ b/frontend/discourse/app/components/modal/forgot-password.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -68,7 +68,7 @@ export default class ForgotPassword extends Component {
if (data.user_found === false) {
key += "_not_found";
- this.flash = htmlSafe(
+ this.flash = trustHTML(
i18n(key, {
email: emailOrUsername,
username: emailOrUsername,
@@ -102,7 +102,7 @@ export default class ForgotPassword extends Component {
>
<:body>
{{#if this.offerHelp}}
- {{htmlSafe this.offerHelp}}
+ {{trustHTML this.offerHelp}}
{{else if this.siteSettings.hide_email_address_taken}}
<label for="username-or-email">
{{i18n "forgot_password.invite_no_username"}}
diff --git a/frontend/discourse/app/components/modal/history/revision.gjs b/frontend/discourse/app/components/modal/history/revision.gjs
index d4f53445b76..2ea4ee5ec97 100644
--- a/frontend/discourse/app/components/modal/history/revision.gjs
+++ b/frontend/discourse/app/components/modal/history/revision.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { on } from "@ember/modifier";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import ageWithTooltip from "discourse/helpers/age-with-tooltip";
import boundAvatarTemplate from "discourse/helpers/bound-avatar-template";
@@ -96,13 +96,13 @@ export default class Revision extends Component {
(and @model.category_id_changes (not @model.archetype_changes))
}}
{{#if @previousCategory}}
- {{htmlSafe @previousCategory}}
+ {{trustHTML @previousCategory}}
{{else}}
{{icon "far-eye-slash" class="diff-del"}}
{{/if}}
&rarr;
{{#if @currentCategory}}
- {{htmlSafe @currentCategory}}
+ {{trustHTML @currentCategory}}
{{else}}
{{icon "far-eye-slash" class="diff-ins"}}
{{/if}}
diff --git a/frontend/discourse/app/components/modal/history/revisions.gjs b/frontend/discourse/app/components/modal/history/revisions.gjs
index 27d5bcbd13c..1c2f10392df 100644
--- a/frontend/discourse/app/components/modal/history/revisions.gjs
+++ b/frontend/discourse/app/components/modal/history/revisions.gjs
@@ -4,7 +4,7 @@ import EmberObject from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import LinksRedirect from "discourse/components/links-redirect";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -91,7 +91,7 @@ export default class Revisions extends Component {
{{/if}}
{{#if @model.title_changes}}
<div class="row">
- <h2 class="revision__title">{{htmlSafe @titleDiff}}</h2>
+ <h2 class="revision__title">{{trustHTML @titleDiff}}</h2>
</div>
{{/if}}
{{#if @mobileView}}
@@ -126,13 +126,13 @@ export default class Revisions extends Component {
{{#if (and @model.category_id_changes (not @model.archetype_changes))}}
<div class="row">
{{#if @previousCategory}}
- {{htmlSafe @previousCategory}}
+ {{trustHTML @previousCategory}}
{{else}}
{{icon "far-eye-slash" class="diff-del"}}
{{/if}}
&rarr;
{{#if @currentCategory}}
- {{htmlSafe @currentCategory}}
+ {{trustHTML @currentCategory}}
{{else}}
{{icon "far-eye-slash" class="diff-ins"}}
{{/if}}
@@ -181,7 +181,7 @@ export default class Revisions extends Component {
{{didUpdate @calculateBodyDiff @bodyDiffHTML}}
class="row body-diff"
>
- {{htmlSafe @bodyDiff}}
+ {{trustHTML @bodyDiff}}
</LinksRedirect>
</div>
</template>
diff --git a/frontend/discourse/app/components/modal/history/topic-footer.gjs b/frontend/discourse/app/components/modal/history/topic-footer.gjs
index 3e997b2f6c7..7616c9e6182 100644
--- a/frontend/discourse/app/components/modal/history/topic-footer.gjs
+++ b/frontend/discourse/app/components/modal/history/topic-footer.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import { and } from "discourse/truth-helpers";
@@ -23,7 +23,7 @@ const TopicFooter = <template>
</div>
<div id="revision-numbers" class={{unless @displayRevisions "invisible"}}>
<ConditionalLoadingSpinner @condition={{@loading}} @size="small">
- {{htmlSafe @revisionsText}}
+ {{trustHTML @revisionsText}}
</ConditionalLoadingSpinner>
</div>
<div class="revision-controls--forward">
diff --git a/frontend/discourse/app/components/modal/keyboard-shortcuts-help.gjs b/frontend/discourse/app/components/modal/keyboard-shortcuts-help.gjs
index 6a20bd75888..bb7050d3656 100644
--- a/frontend/discourse/app/components/modal/keyboard-shortcuts-help.gjs
+++ b/frontend/discourse/app/components/modal/keyboard-shortcuts-help.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { concat } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DModal from "discourse/components/d-modal";
import FilterInput from "discourse/components/filter-input";
import { translateModKey } from "discourse/lib/utilities";
@@ -481,7 +481,7 @@ export default class KeyboardShortcutsHelp extends Component {
}}</h2>
<ul>
{{#each-in shortcutCategory.shortcuts as |name shortcut|}}
- <li>{{htmlSafe shortcut}}</li>
+ <li>{{trustHTML shortcut}}</li>
{{/each-in}}
</ul>
</section>
diff --git a/frontend/discourse/app/components/modal/move-to-topic.gjs b/frontend/discourse/app/components/modal/move-to-topic.gjs
index d0009762ede..63611150218 100644
--- a/frontend/discourse/app/components/modal/move-to-topic.gjs
+++ b/frontend/discourse/app/components/modal/move-to-topic.gjs
@@ -4,7 +4,7 @@ import { Input } from "@ember/component";
import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import ChooseMessage from "discourse/components/choose-message";
import ChooseTopic from "discourse/components/choose-topic";
@@ -246,7 +246,7 @@ export default class MoveToTopic extends Component {
{{#if this.canSplitTopic}}
{{#if this.newMessage}}
<p>
- {{htmlSafe
+ {{trustHTML
(i18n
"topic.move_to_new_message.instructions"
@@ -273,7 +273,7 @@ export default class MoveToTopic extends Component {
{{#if this.existingMessage}}
<p>
- {{htmlSafe
+ {{trustHTML
(i18n
"topic.move_to_existing_message.instructions"
@@ -349,7 +349,7 @@ export default class MoveToTopic extends Component {
{{#if this.existingTopic}}
<p>
- {{htmlSafe
+ {{trustHTML
(i18n
"topic.merge_topic.instructions"
@@ -380,7 +380,7 @@ export default class MoveToTopic extends Component {
{{#if this.canSplitTopic}}
{{#if this.newTopic}}
<p>
- {{htmlSafe
+ {{trustHTML
(i18n
"topic.split_topic.instructions"
@@ -444,7 +444,7 @@ export default class MoveToTopic extends Component {
{{#if this.canSplitTopic}}
{{#if this.newMessage}}
<p>
- {{htmlSafe
+ {{trustHTML
(i18n
"topic.move_to_new_message.instructions"
diff --git a/frontend/discourse/app/components/modal/not-activated.gjs b/frontend/discourse/app/components/modal/not-activated.gjs
index faf24540fb3..9ed548084a8 100644
--- a/frontend/discourse/app/components/modal/not-activated.gjs
+++ b/frontend/discourse/app/components/modal/not-activated.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ActivationControls from "discourse/components/activation-controls";
import DModal from "discourse/components/d-modal";
import { resendActivationEmail } from "discourse/lib/user-activation";
@@ -38,7 +38,7 @@ export default class NotActivated extends Component {
class="not-activated-modal"
>
<:body>
- {{htmlSafe (i18n "login.not_activated" [email protected])}}
+ {{trustHTML (i18n "login.not_activated" [email protected])}}
</:body>
<:footer>
<ActivationControls
diff --git a/frontend/discourse/app/components/modal/post-enqueued.gjs b/frontend/discourse/app/components/modal/post-enqueued.gjs
index 2f8dcfd9b42..a38492ccfd6 100644
--- a/frontend/discourse/app/components/modal/post-enqueued.gjs
+++ b/frontend/discourse/app/components/modal/post-enqueued.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n";
@@ -12,7 +12,7 @@ const PostEnqueued = <template>
<:body>
<p>{{i18n "review.approval.description"}}</p>
<p>
- {{htmlSafe
+ {{trustHTML
(i18n "review.approval.pending_posts" [email protected]_count)
}}
</p>
diff --git a/frontend/discourse/app/components/modal/second-factor-add-security-key.gjs b/frontend/discourse/app/components/modal/second-factor-add-security-key.gjs
index 659d591f2a9..7fd5d81da13 100644
--- a/frontend/discourse/app/components/modal/second-factor-add-security-key.gjs
+++ b/frontend/discourse/app/components/modal/second-factor-add-security-key.gjs
@@ -4,7 +4,7 @@ import { Input } from "@ember/component";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -180,7 +180,7 @@ export default class SecondFactorAddSecurityKey extends Component {
<div class="control-group">
<div class="controls">
- {{htmlSafe
+ {{trustHTML
(i18n "user.second_factor.enable_security_key_description")
}}
</div>
diff --git a/frontend/discourse/app/components/modal/second-factor-add-totp.gjs b/frontend/discourse/app/components/modal/second-factor-add-totp.gjs
index ef7ede8770a..623bbc09d05 100644
--- a/frontend/discourse/app/components/modal/second-factor-add-totp.gjs
+++ b/frontend/discourse/app/components/modal/second-factor-add-totp.gjs
@@ -4,7 +4,7 @@ import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -118,14 +118,14 @@ export default class SecondFactorAddTotp extends Component {
<div class="control-group totp-description">
<div class="controls">
- {{htmlSafe (i18n "user.second_factor.enable_description")}}
+ {{trustHTML (i18n "user.second_factor.enable_description")}}
</div>
</div>
<div class="control-group totp-qr">
<div class="controls">
<div class="qr-code">
- <img src={{htmlSafe this.secondFactorImage}} />
+ <img src={{trustHTML this.secondFactorImage}} />
</div>
<p class="key-code">
{{#if this.showSecondFactorKey}}
diff --git a/frontend/discourse/app/components/modal/second-factor-backup-edit.gjs b/frontend/discourse/app/components/modal/second-factor-backup-edit.gjs
index 61ec88a2631..639ab39a39e 100644
--- a/frontend/discourse/app/components/modal/second-factor-backup-edit.gjs
+++ b/frontend/discourse/app/components/modal/second-factor-backup-edit.gjs
@@ -2,7 +2,7 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import BackupCodes from "discourse/components/backup-codes";
import ConditionalLoadingSection from "discourse/components/conditional-loading-section";
import DButton from "discourse/components/d-button";
@@ -98,14 +98,14 @@ export default class SecondFactorBackupEdit extends Component {
</ConditionalLoadingSection>
{{#if this.backupEnabled}}
- {{htmlSafe
+ {{trustHTML
(i18n
"user.second_factor_backup.remaining_codes"
count=this.remainingCodes
)
}}
{{else}}
- {{htmlSafe (i18n "user.second_factor_backup.not_enabled")}}
+ {{trustHTML (i18n "user.second_factor_backup.not_enabled")}}
{{/if}}
</:body>
<:footer>
diff --git a/frontend/discourse/app/components/more-topics/browse-more.gjs b/frontend/discourse/app/components/more-topics/browse-more.gjs
index cbf39ec37e7..b0db2796874 100644
--- a/frontend/discourse/app/components/more-topics/browse-more.gjs
+++ b/frontend/discourse/app/components/more-topics/browse-more.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { categoryBadgeHTML } from "discourse/helpers/category-link";
import getURL from "discourse/lib/get-url";
import { iconHTML } from "discourse/lib/icon-library";
@@ -106,9 +106,9 @@ export default class BrowseMore extends Component {
<template>
<h3 class="more-topics__browse-more">
{{#if @topic.isPrivateMessage}}
- {{htmlSafe this.privateMessageBrowseMoreMessage}}
+ {{trustHTML this.privateMessageBrowseMoreMessage}}
{{else}}
- {{htmlSafe this.topicBrowseMoreMessage}}
+ {{trustHTML this.topicBrowseMoreMessage}}
{{/if}}
</h3>
</template>
diff --git a/frontend/discourse/app/components/nav-item.gjs b/frontend/discourse/app/components/nav-item.gjs
index c4ac34fce55..8a8b9fa241c 100644
--- a/frontend/discourse/app/components/nav-item.gjs
+++ b/frontend/discourse/app/components/nav-item.gjs
@@ -2,7 +2,7 @@
import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isPresent } from "@ember/utils";
import concatClass from "discourse/helpers/concat-class";
import getURL from "discourse/lib/get-url";
@@ -16,7 +16,7 @@ export default class NavItem extends Component {
get contents() {
const text = this.args.i18nLabel || i18n(this.args.label);
if (this.args.icon) {
- return htmlSafe(`${iconHTML(this.args.icon)} ${text}`);
+ return trustHTML(`${iconHTML(this.args.icon)} ${text}`);
}
return text;
}
diff --git a/frontend/discourse/app/components/page-loading-slider.gjs b/frontend/discourse/app/components/page-loading-slider.gjs
index f38237a2520..adfd4e04395 100644
--- a/frontend/discourse/app/components/page-loading-slider.gjs
+++ b/frontend/discourse/app/components/page-loading-slider.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { run } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import { bind } from "discourse/lib/decorators";
import { eq } from "discourse/truth-helpers";
@@ -50,7 +50,7 @@ export default class PageLoadingSlider extends Component {
get containerStyle() {
const duration = this.loadingSlider.averageLoadingDuration.toFixed(2);
- return htmlSafe(`--loading-duration: ${duration}s`);
+ return trustHTML(`--loading-duration: ${duration}s`);
}
@action
diff --git a/frontend/discourse/app/components/parent-category-row.gjs b/frontend/discourse/app/components/parent-category-row.gjs
index d41e8e87a4e..6fe1614ac02 100644
--- a/frontend/discourse/app/components/parent-category-row.gjs
+++ b/frontend/discourse/app/components/parent-category-row.gjs
@@ -1,6 +1,6 @@
import { array, hash } from "@ember/helper";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import CategoryListItem from "discourse/components/category-list-item";
import CategoryTitleLink from "discourse/components/category-title-link";
import CategoryUnread from "discourse/components/category-unread";
@@ -96,13 +96,13 @@ export default class ParentCategoryRow extends CategoryListItem {
<footer class="clearfix category-topics-count">
<div class="category-stat">
<a href={{this.category.url}}>
- {{htmlSafe this.category.statTotal}}
+ {{trustHTML this.category.statTotal}}
</a>
</div>
{{#unless this.category.pickAll}}
<div class="category-stat">
<a href={{this.category.url}}>
- {{htmlSafe this.category.stat}}
+ {{trustHTML this.category.stat}}
</a>
</div>
{{/unless}}
@@ -208,7 +208,7 @@ export default class ParentCategoryRow extends CategoryListItem {
@outletArgs={{lazyHash category=this.category}}
>
<td class="topics">
- <div title={{this.category.statTitle}}>{{htmlSafe
+ <div title={{this.category.statTitle}}>{{trustHTML
this.category.stat
}}</div>
<CategoryUnread
diff --git a/frontend/discourse/app/components/pinned-button.gjs b/frontend/discourse/app/components/pinned-button.gjs
index 49589565e81..e114bd84cdc 100644
--- a/frontend/discourse/app/components/pinned-button.gjs
+++ b/frontend/discourse/app/components/pinned-button.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PinnedOptions from "discourse/components/pinned-options";
import { i18n } from "discourse-i18n";
@@ -26,7 +26,7 @@ export default class PinnedButton extends Component {
{{#if @appendReason}}
<p class="reason">
<PinnedOptions @value={{@pinned}} @topic={{@topic}} />
- <span class="text">{{htmlSafe this.reasonText}}</span>
+ <span class="text">{{trustHTML this.reasonText}}</span>
</p>
{{else}}
<PinnedOptions @value={{@pinned}} @topic={{@topic}} />
diff --git a/frontend/discourse/app/components/popup-input-tip.gjs b/frontend/discourse/app/components/popup-input-tip.gjs
index 55e8f3af66c..aac966897e7 100644
--- a/frontend/discourse/app/components/popup-input-tip.gjs
+++ b/frontend/discourse/app/components/popup-input-tip.gjs
@@ -3,7 +3,7 @@ import Component from "@ember/component";
import { computed } from "@ember/object";
import { not, or, reads } from "@ember/object/computed";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import {
attributeBindings,
classNameBindings,
@@ -56,7 +56,7 @@ export default class PopupInputTip extends Component {
super.didReceiveAttrs(...arguments);
let reason = this.get("validation.reason");
if (reason) {
- this.set("tipReason", htmlSafe(`${reason}`));
+ this.set("tipReason", trustHTML(`${reason}`));
} else {
this.set("tipReason", null);
}
diff --git a/frontend/discourse/app/components/post-action-description.gjs b/frontend/discourse/app/components/post-action-description.gjs
index 8bde6c60444..744978debe7 100644
--- a/frontend/discourse/app/components/post-action-description.gjs
+++ b/frontend/discourse/app/components/post-action-description.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import {
customGroupActionCodes,
GROUP_ACTION_CODES,
@@ -26,7 +26,7 @@ export function actionDescriptionHtml(actionCode, createdAt, username, path) {
who = `<a class="mention" href="${userPath(username)}">@${username}</a>`;
}
}
- return htmlSafe(i18n(`action_codes.${actionCode}`, { who, when, path }));
+ return trustHTML(i18n(`action_codes.${actionCode}`, { who, when, path }));
}
export default class PostActionDescription extends Component {
diff --git a/frontend/discourse/app/components/post-list/item/details.gjs b/frontend/discourse/app/components/post-list/item/details.gjs
index 660904c3295..53be00bc848 100644
--- a/frontend/discourse/app/components/post-list/item/details.gjs
+++ b/frontend/discourse/app/components/post-list/item/details.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { fn } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
import TopicStatus from "discourse/components/topic-status";
@@ -33,7 +33,7 @@ export default class PostListItemDetails extends Component {
return this.args.titlePath
? this.args.titlePath === "titleHtml" ||
this.args.titlePath === "topic_html_title"
- ? htmlSafe(this.args.post[this.args.titlePath])
+ ? trustHTML(this.args.post[this.args.titlePath])
: this.args.post[this.args.titlePath]
: this.args.post.title;
}
diff --git a/frontend/discourse/app/components/post-list/item/index.gjs b/frontend/discourse/app/components/post-list/item/index.gjs
index c752911abd5..56a2a671f9c 100644
--- a/frontend/discourse/app/components/post-list/item/index.gjs
+++ b/frontend/discourse/app/components/post-list/item/index.gjs
@@ -3,7 +3,7 @@ import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DecoratedHtml from "discourse/components/decorated-html";
import ExpandPost from "discourse/components/expand-post";
@@ -181,7 +181,7 @@ export default class PostListItem extends Component {
class="excerpt"
>
<DecoratedHtml
- @html={{htmlSafe (or @post.expandedExcerpt @post.excerpt)}}
+ @html={{trustHTML (or @post.expandedExcerpt @post.excerpt)}}
@className="cooked"
/>
</div>
diff --git a/frontend/discourse/app/components/post/cooked-html.gjs b/frontend/discourse/app/components/post/cooked-html.gjs
index e784fb96ca9..3a961faa6a0 100644
--- a/frontend/discourse/app/components/post/cooked-html.gjs
+++ b/frontend/discourse/app/components/post/cooked-html.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { getOwner } from "@ember/owner";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { TrackedMap } from "@ember-compat/tracked-built-ins";
import curryComponent from "ember-curry-component";
import DecoratedHtml, {
@@ -192,7 +192,7 @@ export default class PostCookedHtml extends Component {
isIgnored=this.isIgnored
ignoredUsers=this.ignoredUsers
}}
- @html={{htmlSafe this.cooked}}
+ @html={{trustHTML this.cooked}}
@model={{@post}}
/>
</template>
diff --git a/frontend/discourse/app/components/post/notice/custom.gjs b/frontend/discourse/app/components/post/notice/custom.gjs
index eb8a2b79fac..9c0d156dd92 100644
--- a/frontend/discourse/app/components/post/notice/custom.gjs
+++ b/frontend/discourse/app/components/post/notice/custom.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import ConditionalInElement from "discourse/components/conditional-in-element";
import UserLink from "discourse/components/user-link";
@@ -28,9 +28,9 @@ export default class PostNoticeCustom extends Component {
<template>
{{icon "user-shield"}}
<div class="post-notice-message" {{this.registerCreatedByLink}}>
- {{htmlSafe @notice.cooked}}
+ {{trustHTML @notice.cooked}}
{{#if this.createdByName}}
- {{htmlSafe
+ {{trustHTML
(i18n
"post.notice.custom_created_by"
userLinkHTML="<span class='custom_created_by'></span>"
diff --git a/frontend/discourse/app/components/post/small-action.gjs b/frontend/discourse/app/components/post/small-action.gjs
index eccdb8f8e0a..5556f51fbbc 100644
--- a/frontend/discourse/app/components/post/small-action.gjs
+++ b/frontend/discourse/app/components/post/small-action.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { cached } from "@glimmer/tracking";
import { concat } from "@ember/helper";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { TrackedMap } from "@ember-compat/tracked-built-ins";
import DButton from "discourse/components/d-button";
import PostCookedHtml from "discourse/components/post/cooked-html";
@@ -118,7 +118,7 @@ export default class PostSmallAction extends Component {
}
}
- return htmlSafe(
+ return trustHTML(
i18n(`action_codes.${this.code}`, { who, when, path: this.path })
);
}
@@ -198,7 +198,7 @@ export default class PostSmallAction extends Component {
{{else}}
{{! aria-hidden is set to true because the a11y heading text is
almost the same as the description}}
- <p aria-hidden="true">{{htmlSafe this.description}}</p>
+ <p aria-hidden="true">{{trustHTML this.description}}</p>
{{/if}}
</div>
<div class="small-action-buttons">
diff --git a/frontend/discourse/app/components/related-messages.gjs b/frontend/discourse/app/components/related-messages.gjs
index 37949d9915c..d86c019493d 100644
--- a/frontend/discourse/app/components/related-messages.gjs
+++ b/frontend/discourse/app/components/related-messages.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { cached } from "@glimmer/tracking";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import BasicTopicList from "discourse/components/basic-topic-list";
import getURL from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
@@ -59,7 +59,7 @@ export default class RelatedMessages extends Component {
{{#if this.targetUser}}
<h3 class="see-all-pms-message">
- {{htmlSafe
+ {{trustHTML
(i18n
"related_messages.see_all"
path=this.searchLink
diff --git a/frontend/discourse/app/components/reviewable/insights.gjs b/frontend/discourse/app/components/reviewable/insights.gjs
index 471bbad90d1..f1702c06f3c 100644
--- a/frontend/discourse/app/components/reviewable/insights.gjs
+++ b/frontend/discourse/app/components/reviewable/insights.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import IpLookup from "discourse/components/reviewable/ip-lookup";
import { shortDate } from "discourse/lib/formatter";
import { i18n } from "discourse-i18n";
@@ -84,7 +84,7 @@ export default class ReviewableInsights extends Component {
insights.push({
icon: "users",
label: i18n("review.insights.user_activity"),
- description: htmlSafe(activities.join(", ")),
+ description: trustHTML(activities.join(", ")),
});
// Visibility insight
diff --git a/frontend/discourse/app/components/reviewable/ip-lookup.gjs b/frontend/discourse/app/components/reviewable/ip-lookup.gjs
index 28699dd8f4c..af52f0d4cb3 100644
--- a/frontend/discourse/app/components/reviewable/ip-lookup.gjs
+++ b/frontend/discourse/app/components/reviewable/ip-lookup.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import IpLookupAccountsTable from "discourse/admin/components/ip-lookup-accounts-table";
import AdminUser from "discourse/admin/models/admin-user";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
@@ -154,7 +154,7 @@ export default class ReviewableIpLookup extends Component {
<div class="review-insight__label">
{{i18n "ip_lookup.title"}}
<span class="ip-lookup-powered-by">
- ({{htmlSafe (i18n "ip_lookup.powered_by")}})
+ ({{trustHTML (i18n "ip_lookup.powered_by")}})
</span>
</div>
<div class="review-insight__description">
diff --git a/frontend/discourse/app/components/reviewable/post.gjs b/frontend/discourse/app/components/reviewable/post.gjs
index c47a7bb81f8..5051f59124f 100644
--- a/frontend/discourse/app/components/reviewable/post.gjs
+++ b/frontend/discourse/app/components/reviewable/post.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DecoratedHtml, {
applyHtmlDecorators,
} from "discourse/components/decorated-html";
@@ -73,7 +73,7 @@ export default class ReviewablePost extends Component {
{{else}}
<DecoratedHtml
@className="review-item__post-content"
- @html={{htmlSafe @reviewable.cooked}}
+ @html={{trustHTML @reviewable.cooked}}
@decorate={{this.decorate}}
@model={{@reviewable}}
/>
diff --git a/frontend/discourse/app/components/reviewable/timeline.gjs b/frontend/discourse/app/components/reviewable/timeline.gjs
index a0cbab65112..62d2db8a9e5 100644
--- a/frontend/discourse/app/components/reviewable/timeline.gjs
+++ b/frontend/discourse/app/components/reviewable/timeline.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DecoratedHtml from "discourse/components/decorated-html";
import InterpolatedTranslation from "discourse/components/interpolated-translation";
@@ -108,7 +108,7 @@ export default class ReviewableTimeline extends Component {
user: score.user,
icon: "flag",
titleKey: "review.timeline.flagged_as_by",
- description: htmlSafe(flaggedDescription),
+ description: trustHTML(flaggedDescription),
score: {
count: 0,
type: score.score_type.type,
@@ -166,7 +166,7 @@ export default class ReviewableTimeline extends Component {
user: note.user,
icon: "far-pen-to-square",
titleKey: "review.timeline.note_added_by",
- description: htmlSafe(`<p>${escape(note.content)}</p>`),
+ description: trustHTML(`<p>${escape(note.content)}</p>`),
noteId: note.id,
canDelete:
this.currentUser &&
diff --git a/frontend/discourse/app/components/rich-hashtag-autocomplete-results.gjs b/frontend/discourse/app/components/rich-hashtag-autocomplete-results.gjs
index 9a8d9f46c42..2b3f78935e4 100644
--- a/frontend/discourse/app/components/rich-hashtag-autocomplete-results.gjs
+++ b/frontend/discourse/app/components/rich-hashtag-autocomplete-results.gjs
@@ -7,7 +7,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import scrollIntoView from "discourse/modifiers/scroll-into-view";
import { eq } from "discourse/truth-helpers";
@@ -73,7 +73,7 @@ export default class RichHashtagAutocompleteResults extends Component {
href
{{on "click" (fn this.handleResultClick result index)}}
>
- {{htmlSafe result.iconHtml}}
+ {{trustHTML result.iconHtml}}
<span class="hashtag-autocomplete__text">
{{result.text}}
{{#if result.secondary_text}}
diff --git a/frontend/discourse/app/components/search-menu/highlighted-search.gjs b/frontend/discourse/app/components/search-menu/highlighted-search.gjs
index 00fb59c90e1..361c2d408e5 100644
--- a/frontend/discourse/app/components/search-menu/highlighted-search.gjs
+++ b/frontend/discourse/app/components/search-menu/highlighted-search.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import highlightSearch from "discourse/lib/highlight-search";
export default class HighlightedSearch extends Component {
@@ -15,7 +15,7 @@ export default class HighlightedSearch extends Component {
<template>
<span {{didInsert this.highlight}}>
- {{htmlSafe @string}}
+ {{trustHTML @string}}
</span>
</template>
}
diff --git a/frontend/discourse/app/components/search-menu/results/blurb.gjs b/frontend/discourse/app/components/search-menu/results/blurb.gjs
index e8be891bec3..714507174a8 100644
--- a/frontend/discourse/app/components/search-menu/results/blurb.gjs
+++ b/frontend/discourse/app/components/search-menu/results/blurb.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import HighlightedSearch from "discourse/components/search-menu/highlighted-search";
import ageWithTooltip from "discourse/helpers/age-with-tooltip";
@@ -12,7 +12,7 @@ export default class Blurb extends Component {
{{ageWithTooltip @result.created_at}}
<span class="blurb__separator"> - </span>
{{#if this.siteSettings.use_pg_headlines_for_excerpt}}
- <span>{{htmlSafe @result.blurb}}</span>
+ <span>{{trustHTML @result.blurb}}</span>
{{else}}
<span class="blurb__text">
<HighlightedSearch @string={{@result.blurb}} />
diff --git a/frontend/discourse/app/components/search-menu/results/type/topic.gjs b/frontend/discourse/app/components/search-menu/results/type/topic.gjs
index be4cff48e51..36c039b7305 100644
--- a/frontend/discourse/app/components/search-menu/results/type/topic.gjs
+++ b/frontend/discourse/app/components/search-menu/results/type/topic.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import HighlightedSearch from "discourse/components/search-menu/highlighted-search";
import Blurb from "discourse/components/search-menu/results/blurb";
@@ -36,7 +36,7 @@ export default class Results extends Component {
)
}}
<a href={{if @withTopicUrl @result.url}}>
- {{replaceEmoji (htmlSafe @result.topic_title_headline)}}
+ {{replaceEmoji (trustHTML @result.topic_title_headline)}}
</a>
{{else}}
<a href={{if @withTopicUrl @result.url}}>
diff --git a/frontend/discourse/app/components/search-result-entry.gjs b/frontend/discourse/app/components/search-result-entry.gjs
index 84e2c3d69cb..019b613aa8c 100644
--- a/frontend/discourse/app/components/search-result-entry.gjs
+++ b/frontend/discourse/app/components/search-result-entry.gjs
@@ -3,7 +3,7 @@ import Component from "@ember/component";
import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import {
attributeBindings,
classNameBindings,
@@ -90,10 +90,10 @@ export default class SearchResultEntry extends Component {
<span class="topic-title">
{{#if this.post.useTopicTitleHeadline}}
- {{htmlSafe this.post.topicTitleHeadline}}
+ {{trustHTML this.post.topicTitleHeadline}}
{{else}}
<HighlightSearch @highlight={{this.highlightQuery}}>
- {{htmlSafe this.post.topic.fancyTitle}}
+ {{trustHTML this.post.topic.fancyTitle}}
</HighlightSearch>
{{/if}}
</span>
@@ -139,10 +139,10 @@ export default class SearchResultEntry extends Component {
{{#if this.post.blurb}}
{{#if this.siteSettings.use_pg_headlines_for_excerpt}}
- {{htmlSafe this.post.blurb}}
+ {{trustHTML this.post.blurb}}
{{else}}
<HighlightSearch @highlight={{this.highlightQuery}}>
- {{htmlSafe this.post.blurb}}
+ {{trustHTML this.post.blurb}}
</HighlightSearch>
{{/if}}
{{/if}}
diff --git a/frontend/discourse/app/components/second-factor-form.gjs b/frontend/discourse/app/components/second-factor-form.gjs
index 702999855d8..9aa92f8654f 100644
--- a/frontend/discourse/app/components/second-factor-form.gjs
+++ b/frontend/discourse/app/components/second-factor-form.gjs
@@ -2,7 +2,7 @@
import Component from "@ember/component";
import { on } from "@ember/modifier";
import { action, computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { SECOND_FACTOR_METHODS } from "discourse/models/user";
import { i18n } from "discourse-i18n";
@@ -72,7 +72,7 @@ export default class SecondFactorForm extends Component {
<h3>{{this.secondFactorTitle}}</h3>
{{#if this.optionalText}}
- <p>{{htmlSafe this.optionalText}}</p>
+ <p>{{trustHTML this.optionalText}}</p>
{{/if}}
<p class="second-factor__description">{{this.secondFactorDescription}}</p>
diff --git a/frontend/discourse/app/components/share-panel.gjs b/frontend/discourse/app/components/share-panel.gjs
index 5f86fac2cd1..a61e6dbe572 100644
--- a/frontend/discourse/app/components/share-panel.gjs
+++ b/frontend/discourse/app/components/share-panel.gjs
@@ -2,7 +2,7 @@
import Component from "@ember/component";
import { action, computed } from "@ember/object";
import { alias } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import DTextarea from "discourse/components/d-textarea";
import ShareSource from "discourse/components/share-source";
@@ -73,7 +73,7 @@ export default class SharePanel extends Component {
<template>
<div class="header">
- <h3 class="title">{{htmlSafe this.shareTitle}}</h3>
+ <h3 class="title">{{trustHTML this.shareTitle}}</h3>
</div>
<div class="body">
diff --git a/frontend/discourse/app/components/sidebar/section-link-prefix.gjs b/frontend/discourse/app/components/sidebar/section-link-prefix.gjs
index b65bf7f5a86..23ff5a869d3 100644
--- a/frontend/discourse/app/components/sidebar/section-link-prefix.gjs
+++ b/frontend/discourse/app/components/sidebar/section-link-prefix.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isHex } from "discourse/components/sidebar/section-link";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
@@ -42,7 +42,7 @@ export default class SidebarSectionLinkPrefix extends Component {
<template>
{{#if @prefixType}}
<span
- style={{if @prefixColor (htmlSafe (concat "color: " @prefixColor))}}
+ style={{if @prefixColor (trustHTML (concat "color: " @prefixColor))}}
class={{concatClass
"sidebar-section-link-prefix"
@prefixType
@@ -61,7 +61,7 @@ export default class SidebarSectionLinkPrefix extends Component {
{{replaceEmoji this.prefixValue class="prefix-emoji"}}
{{else if (eq @prefixType "square")}}
<span
- style={{htmlSafe
+ style={{trustHTML
(concat
"background: linear-gradient(90deg, " this.prefixValue ")"
)
diff --git a/frontend/discourse/app/components/signup-cta.gjs b/frontend/discourse/app/components/signup-cta.gjs
index d784df6c136..6743076d4f9 100644
--- a/frontend/discourse/app/components/signup-cta.gjs
+++ b/frontend/discourse/app/components/signup-cta.gjs
@@ -1,7 +1,7 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { on } from "@ember-decorators/object";
import DButton from "discourse/components/d-button";
@@ -37,8 +37,8 @@ export default class SignupCta extends Component {
{{#if this.session.hideSignupCta}}
<h3>{{i18n "signup_cta.hidden_for_session"}}</h3>
{{else}}
- <h3>{{replaceEmoji (htmlSafe (i18n "signup_cta.intro"))}}</h3>
- <p>{{replaceEmoji (htmlSafe (i18n "signup_cta.value_prop"))}}</p>
+ <h3>{{replaceEmoji (trustHTML (i18n "signup_cta.intro"))}}</h3>
+ <p>{{replaceEmoji (trustHTML (i18n "signup_cta.value_prop"))}}</p>
<div class="buttons">
<DButton
diff --git a/frontend/discourse/app/components/signup-page-cta.gjs b/frontend/discourse/app/components/signup-page-cta.gjs
index 6476ae3fb57..e21e46a934d 100644
--- a/frontend/discourse/app/components/signup-page-cta.gjs
+++ b/frontend/discourse/app/components/signup-page-cta.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
import { i18n } from "discourse-i18n";
@@ -7,7 +7,7 @@ const SignupPageCta = <template>
<div class="signup-page-cta">
{{#if @disclaimerHtml}}
<div class="signup-page-cta__disclaimer">
- {{htmlSafe @disclaimerHtml}}
+ {{trustHTML @disclaimerHtml}}
</div>
{{/if}}
<div class="signup-page-cta__buttons">
diff --git a/frontend/discourse/app/components/subcategories-with-featured-topics.gjs b/frontend/discourse/app/components/subcategories-with-featured-topics.gjs
index f95a944d4d4..eea3ef8b9e3 100644
--- a/frontend/discourse/app/components/subcategories-with-featured-topics.gjs
+++ b/frontend/discourse/app/components/subcategories-with-featured-topics.gjs
@@ -1,6 +1,6 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import CategoryTitleLink from "discourse/components/category-title-link";
import ParentCategoryRow from "discourse/components/parent-category-row";
@@ -21,7 +21,7 @@ export default class SubcategoriesWithFeaturedTopics extends Component {
<div class="category-list subcategory-list with-topics">
<div class="parent-category">
<CategoryTitleLink @category={{category}} />
- <span class="stat" title={{category.statTitle}}>{{htmlSafe
+ <span class="stat" title={{category.statTitle}}>{{trustHTML
category.stat
}}</span>
</div>
@@ -51,7 +51,7 @@ export default class SubcategoriesWithFeaturedTopics extends Component {
<tr>
<th class="parent-category">
<CategoryTitleLink @category={{category}} />
- <span class="stat" title={{category.statTitle}}>{{htmlSafe
+ <span class="stat" title={{category.statTitle}}>{{trustHTML
category.stat
}}</span>
</th>
diff --git a/frontend/discourse/app/components/tag-info.gjs b/frontend/discourse/app/components/tag-info.gjs
index e0040a85eda..e14da42d504 100644
--- a/frontend/discourse/app/components/tag-info.gjs
+++ b/frontend/discourse/app/components/tag-info.gjs
@@ -6,7 +6,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -342,7 +342,7 @@ export default class TagInfo extends Component {
</div>
{{#if this.tagInfo.description}}
<div class="tag-description-wrapper">
- <span>{{htmlSafe this.tagInfo.description}}</span>
+ <span>{{trustHTML this.tagInfo.description}}</span>
</div>
{{/if}}
{{/if}}
@@ -365,9 +365,9 @@ export default class TagInfo extends Component {
{{#if this.tagInfo.category_restricted}}
{{i18n "tagging.category_restricted"}}
{{else}}
- {{htmlSafe (i18n "tagging.default_info")}}
+ {{trustHTML (i18n "tagging.default_info")}}
{{#if this.canAdminTag}}
- {{htmlSafe (i18n "tagging.staff_info" basePath=(basePath))}}
+ {{trustHTML (i18n "tagging.staff_info" basePath=(basePath))}}
{{/if}}
{{/if}}
{{/if}}
@@ -377,7 +377,7 @@ export default class TagInfo extends Component {
<div class="synonyms-list">
<h3>{{i18n "tagging.synonyms"}}</h3>
- <div>{{htmlSafe
+ <div>{{trustHTML
(i18n
"tagging.synonyms_description" base_tag_name=this.tagInfo.name
)
diff --git a/frontend/discourse/app/components/time-input.gjs b/frontend/discourse/app/components/time-input.gjs
index e11d5bad4e3..9049b2f46ea 100644
--- a/frontend/discourse/app/components/time-input.gjs
+++ b/frontend/discourse/app/components/time-input.gjs
@@ -2,7 +2,7 @@
import Component from "@ember/component";
import { hash } from "@ember/helper";
import { action, computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isPresent } from "@ember/utils";
import { tagName } from "@ember-decorators/component";
import ComboBox from "discourse/select-kit/components/combo-box";
@@ -126,7 +126,7 @@ export default class TimeInput extends Component {
.diff(this.relativeDate, "minutes");
if (diff < 1440) {
- label = htmlSafe(
+ label = trustHTML(
`${name} <small>(${convertMinutesToDurationString(diff)})</small>`
);
}
diff --git a/frontend/discourse/app/components/toolbar-popup-menu-options.gjs b/frontend/discourse/app/components/toolbar-popup-menu-options.gjs
index 15929bc95f1..ddeb913b585 100644
--- a/frontend/discourse/app/components/toolbar-popup-menu-options.gjs
+++ b/frontend/discourse/app/components/toolbar-popup-menu-options.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { array, concat, fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import DButton from "discourse/components/d-button";
import DropdownMenu from "discourse/components/dropdown-menu";
@@ -125,7 +125,7 @@ export default class ToolbarPopupMenuOptions extends Component {
});
}
- return htmlSafe(htmlLabel);
+ return trustHTML(htmlLabel);
}
get convertedContent() {
diff --git a/frontend/discourse/app/components/topic-entrance.gjs b/frontend/discourse/app/components/topic-entrance.gjs
index 6363f1b97e1..7f172e4904c 100644
--- a/frontend/discourse/app/components/topic-entrance.gjs
+++ b/frontend/discourse/app/components/topic-entrance.gjs
@@ -3,7 +3,7 @@ import Component from "@ember/component";
import { action, computed } from "@ember/object";
import { scheduleOnce } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNameBindings } from "@ember-decorators/component";
import { on } from "@ember-decorators/object";
import $ from "jquery";
@@ -214,7 +214,7 @@ export default class TopicEntrance extends Component {
class="btn-default full jump-top"
>
{{icon "backward-step"}}
- {{htmlSafe this.topDate}}
+ {{trustHTML this.topDate}}
</DButton>
<DButton
@@ -226,7 +226,7 @@ export default class TopicEntrance extends Component {
title={{i18n "topic_entrance.jump_bottom_button_title"}}
class="btn-default full jump-bottom"
>
- {{htmlSafe this.bottomDate}}
+ {{trustHTML this.bottomDate}}
{{icon "forward-step"}}
</DButton>
</template>
diff --git a/frontend/discourse/app/components/topic-list/featured-topic.gjs b/frontend/discourse/app/components/topic-list/featured-topic.gjs
index 06701e657b6..865acb03b05 100644
--- a/frontend/discourse/app/components/topic-list/featured-topic.gjs
+++ b/frontend/discourse/app/components/topic-list/featured-topic.gjs
@@ -1,5 +1,5 @@
import { on } from "@ember/modifier";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import TopicPostBadges from "discourse/components/topic-post-badges";
import TopicStatus from "discourse/components/topic-status";
import ageWithTooltip from "discourse/helpers/age-with-tooltip";
@@ -19,7 +19,7 @@ const FeaturedTopic = <template>
<div data-topic-id={{@topic.id}} class="featured-topic --glimmer">
<TopicStatus @topic={{@topic}} @context="topic-list" />
- <a href={{@topic.lastUnreadUrl}} class="title">{{htmlSafe
+ <a href={{@topic.lastUnreadUrl}} class="title">{{trustHTML
@topic.fancyTitle
}}</a>
diff --git a/frontend/discourse/app/components/topic-list/item.gjs b/frontend/discourse/app/components/topic-list/item.gjs
index 5b027dfa0a4..5db05ed39c4 100644
--- a/frontend/discourse/app/components/topic-list/item.gjs
+++ b/frontend/discourse/app/components/topic-list/item.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { next } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe, isHTMLSafe } from "@ember/template";
+import { isHTMLSafe, trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import PluginOutlet from "discourse/components/plugin-outlet";
import BulkSelectCheckbox from "discourse/components/topic-list/bulk-select-checkbox";
@@ -267,7 +267,7 @@ export default class Item extends Component {
});
if (safeParts.length) {
- return htmlSafe(safeParts.join("\n"));
+ return trustHTML(safeParts.join("\n"));
}
}
diff --git a/frontend/discourse/app/components/topic-list/item/activity-cell.gjs b/frontend/discourse/app/components/topic-list/item/activity-cell.gjs
index fa3f956ff2b..3beed10e467 100644
--- a/frontend/discourse/app/components/topic-list/item/activity-cell.gjs
+++ b/frontend/discourse/app/components/topic-list/item/activity-cell.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import coldAgeClass from "discourse/helpers/cold-age-class";
import concatClass from "discourse/helpers/concat-class";
@@ -7,7 +7,7 @@ import lazyHash from "discourse/helpers/lazy-hash";
const ActivityCell = <template>
<td
- title={{htmlSafe @topic.bumpedAtTitle}}
+ title={{trustHTML @topic.bumpedAtTitle}}
class={{concatClass
"activity num topic-list-data"
(coldAgeClass @topic.createdAt [email protected] class="")
diff --git a/frontend/discourse/app/components/topic-list/topic-link.gjs b/frontend/discourse/app/components/topic-list/topic-link.gjs
index 29a269089ce..28e4e93770c 100644
--- a/frontend/discourse/app/components/topic-list/topic-link.gjs
+++ b/frontend/discourse/app/components/topic-list/topic-link.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import lazyHash from "discourse/helpers/lazy-hash";
@@ -19,7 +19,7 @@ export default class TopicLink extends Component {
data-topic-id={{@topic.id}}
class="title"
...attributes
- >{{htmlSafe @topic.fancyTitle}}{{yield}}</a>
+ >{{trustHTML @topic.fancyTitle}}{{yield}}</a>
{{~! no whitespace ~}}
</PluginOutlet>
{{~! no whitespace ~}}
diff --git a/frontend/discourse/app/components/topic-map/topic-map-summary.gjs b/frontend/discourse/app/components/topic-map/topic-map-summary.gjs
index 8fb37624210..1583850cfe5 100644
--- a/frontend/discourse/app/components/topic-map/topic-map-summary.gjs
+++ b/frontend/discourse/app/components/topic-map/topic-map-summary.gjs
@@ -4,7 +4,7 @@ import { hash } from "@ember/helper";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -319,7 +319,7 @@ export default class TopicMapSummary extends Component {
{{post.like_count}}
{{icon "heart"}}</span>
<p>
- {{htmlSafe (emojiUnescape post.blurb)}}
+ {{trustHTML (emojiUnescape post.blurb)}}
</p>
</a>
</li>
diff --git a/frontend/discourse/app/components/topic-map/topic-participant.gjs b/frontend/discourse/app/components/topic-map/topic-participant.gjs
index 520861107e2..403bd28fc82 100644
--- a/frontend/discourse/app/components/topic-map/topic-participant.gjs
+++ b/frontend/discourse/app/components/topic-map/topic-participant.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import UserAvatarFlair from "discourse/components/user-avatar-flair";
import UserLink from "discourse/components/user-link";
@@ -16,7 +16,7 @@ export function addTopicParticipantClassesCallback(callback) {
export default class TopicParticipant extends Component {
get avatarImage() {
- return htmlSafe(
+ return trustHTML(
avatarImg({
avatarTemplate: this.args.participant.avatar_template,
size: "medium",
diff --git a/frontend/discourse/app/components/topic-progress.gjs b/frontend/discourse/app/components/topic-progress.gjs
index bf578b737b6..84a77d485ce 100644
--- a/frontend/discourse/app/components/topic-progress.gjs
+++ b/frontend/discourse/app/components/topic-progress.gjs
@@ -3,7 +3,7 @@ import Component from "@ember/component";
import { action, computed } from "@ember/object";
import { alias } from "@ember/object/computed";
import { scheduleOnce } from "@ember/runloop";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNameBindings } from "@ember-decorators/component";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -122,7 +122,7 @@ export default class TopicProgress extends Component {
aria-label={{i18n "topic.progress.title"}}
class={{if this.hideProgress "hidden"}}
id="topic-progress"
- style={{htmlSafe this.progressStyle}}
+ style={{trustHTML this.progressStyle}}
>
<div class="nums">
<span>{{this.progressPosition}}</span>
diff --git a/frontend/discourse/app/components/topic-timeline/container.gjs b/frontend/discourse/app/components/topic-timeline/container.gjs
index e284662f2dd..e09fe48352f 100644
--- a/frontend/discourse/app/components/topic-timeline/container.gjs
+++ b/frontend/discourse/app/components/topic-timeline/container.gjs
@@ -5,7 +5,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
import { actionDescriptionHtml } from "discourse/components/post-action-description";
@@ -171,7 +171,7 @@ export default class TopicTimelineScrollArea extends Component {
}
get topicTitle() {
- return htmlSafe(this.site.mobileView ? this.args.model.fancyTitle : "");
+ return trustHTML(this.site.mobileView ? this.args.model.fancyTitle : "");
}
get showTags() {
@@ -181,15 +181,15 @@ export default class TopicTimelineScrollArea extends Component {
}
get style() {
- return htmlSafe(`height: ${this.scrollareaHeight}px`);
+ return trustHTML(`height: ${this.scrollareaHeight}px`);
}
get beforePadding() {
- return htmlSafe(`height: ${this.before}px`);
+ return trustHTML(`height: ${this.before}px`);
}
get afterPadding() {
- return htmlSafe(`height: ${this.after}px`);
+ return trustHTML(`height: ${this.after}px`);
}
get showDockedButton() {
@@ -208,7 +208,7 @@ export default class TopicTimelineScrollArea extends Component {
}
get lastReadStyle() {
- return htmlSafe(
+ return trustHTML(
`height: ${LAST_READ_HEIGHT}px; top: ${this.topPosition}px`
);
}
@@ -266,7 +266,7 @@ export default class TopicTimelineScrollArea extends Component {
@bind
calculatePosition() {
- this.timelineScrollareaStyle = htmlSafe(
+ this.timelineScrollareaStyle = trustHTML(
`height: ${this.scrollareaHeight}px`
);
@@ -538,7 +538,7 @@ export default class TopicTimelineScrollArea extends Component {
{{/if}}
{{#if this.excerpt}}
- <div class="post-excerpt">{{htmlSafe this.excerpt}}</div>
+ <div class="post-excerpt">{{trustHTML this.excerpt}}</div>
{{/if}}
</div>
{{/if}}
diff --git a/frontend/discourse/app/components/topic-timeline/scroller.gjs b/frontend/discourse/app/components/topic-timeline/scroller.gjs
index 1eab2e00440..44a3ed106e3 100644
--- a/frontend/discourse/app/components/topic-timeline/scroller.gjs
+++ b/frontend/discourse/app/components/topic-timeline/scroller.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import {
SCROLLER_HEIGHT,
timelineDate,
@@ -10,7 +10,7 @@ import { i18n } from "discourse-i18n";
import BackButton from "./back-button";
export default class TopicTimelineScroller extends Component {
- style = htmlSafe(`height: ${SCROLLER_HEIGHT}px`);
+ style = trustHTML(`height: ${SCROLLER_HEIGHT}px`);
get repliesShort() {
return i18n(`topic.timeline.replies_short`, {
diff --git a/frontend/discourse/app/components/topic-timer-info.gjs b/frontend/discourse/app/components/topic-timer-info.gjs
index 2adec2c725f..d7e913b6e7b 100644
--- a/frontend/discourse/app/components/topic-timer-info.gjs
+++ b/frontend/discourse/app/components/topic-timer-info.gjs
@@ -2,7 +2,7 @@
import Component from "@ember/component";
import { computed } from "@ember/object";
import { cancel, next } from "@ember/runloop";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { on } from "@ember-decorators/object";
import DButton from "discourse/components/d-button";
@@ -15,7 +15,7 @@ import { i18n } from "discourse-i18n";
@tagName("")
export default class TopicTimerInfo extends Component {
- clockIcon = htmlSafe(`${iconHTML("far-clock")}`);
+ clockIcon = trustHTML(`${iconHTML("far-clock")}`);
trashLabel = i18n("post.controls.remove_timer");
title = null;
@@ -121,8 +121,8 @@ export default class TopicTimerInfo extends Component {
options = Object.assign(options, this.additionalOpts());
this.setProperties({
- title: htmlSafe(`${moment(this.executeAt).format("LLLL")}`),
- notice: htmlSafe(`${i18n(this._noticeKey(), options)}`),
+ title: trustHTML(`${moment(this.executeAt).format("LLLL")}`),
+ notice: trustHTML(`${i18n(this._noticeKey(), options)}`),
showTopicTimer: true,
});
diff --git a/frontend/discourse/app/components/uppy-image-uploader.gjs b/frontend/discourse/app/components/uppy-image-uploader.gjs
index 3350e5c80aa..279d7d8090b 100644
--- a/frontend/discourse/app/components/uppy-image-uploader.gjs
+++ b/frontend/discourse/app/components/uppy-image-uploader.gjs
@@ -5,7 +5,7 @@ import { action } from "@ember/object";
import { guidFor } from "@ember/object/internals";
import { getOwner } from "@ember/owner";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { modifier } from "ember-modifier";
import DButton from "discourse/components/d-button";
@@ -92,14 +92,14 @@ export default class UppyImageUploader extends Component {
get placeholderStyle() {
if (isEmpty(this.args.placeholderUrl)) {
- return htmlSafe("");
+ return trustHTML("");
}
- return htmlSafe(`background-image: url(${this.args.placeholderUrl})`);
+ return trustHTML(`background-image: url(${this.args.placeholderUrl})`);
}
get imageCdnUrl() {
if (isEmpty(this.args.imageUrl)) {
- return htmlSafe("");
+ return trustHTML("");
}
return getURLWithCDN(this.args.imageUrl);
@@ -112,9 +112,9 @@ export default class UppyImageUploader extends Component {
get backgroundStyle() {
// Only apply background style for images, not videos
if (this.isVideoFile) {
- return htmlSafe("");
+ return trustHTML("");
}
- return htmlSafe(`background-image: url(${this.imageCdnUrl})`);
+ return trustHTML(`background-image: url(${this.imageCdnUrl})`);
}
get imageBaseName() {
@@ -125,7 +125,7 @@ export default class UppyImageUploader extends Component {
get progressBarStyle() {
let progress = this.uppyUpload.uploadProgress || 0;
- return htmlSafe(`width: ${progress}%`);
+ return trustHTML(`width: ${progress}%`);
}
get acceptedFormats() {
diff --git a/frontend/discourse/app/components/user-card-contents.gjs b/frontend/discourse/app/components/user-card-contents.gjs
index 781d383c4e6..e500dbc3ab7 100644
--- a/frontend/discourse/app/components/user-card-contents.gjs
+++ b/frontend/discourse/app/components/user-card-contents.gjs
@@ -5,7 +5,7 @@ import EmberObject, { action, computed, set } from "@ember/object";
import { alias, and, gt, gte, not, or } from "@ember/object/computed";
import { LinkTo } from "@ember/routing";
import { dasherize } from "@ember/string";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { compare, isEmpty } from "@ember/utils";
import {
attributeBindings,
@@ -488,7 +488,7 @@ export default class UserCardContents extends CardContentsBase {
{{/if}}
{{#if this.hasStatus}}
<div class="user-status">
- {{htmlSafe this.userStatusEmoji}}
+ {{trustHTML this.userStatusEmoji}}
<span class="user-status__description">
{{this.user.status.description}}
</span>
@@ -599,7 +599,7 @@ export default class UserCardContents extends CardContentsBase {
<span class="suspension-reason-title">{{i18n
"user.suspended_reason"
}}</span>
- <span class="suspension-reason-description">{{htmlSafe
+ <span class="suspension-reason-description">{{trustHTML
this.user.suspend_reason
}}</span>
</div>
@@ -622,7 +622,7 @@ export default class UserCardContents extends CardContentsBase {
<span class="silence-reason-title">{{i18n
"user.silenced_reason"
}}</span>
- <span class="silence-reason-description">{{htmlSafe
+ <span class="silence-reason-description">{{trustHTML
this.user.silence_reason
}}</span>
</div>
@@ -631,7 +631,7 @@ export default class UserCardContents extends CardContentsBase {
{{#unless this.isRestricted}}
<div class="bio">
<HtmlWithLinks>
- {{htmlSafe this.user.bio_excerpt}}
+ {{trustHTML this.user.bio_excerpt}}
</HtmlWithLinks>
</div>
{{/unless}}
@@ -649,7 +649,7 @@ export default class UserCardContents extends CardContentsBase {
this.user.featured_topic.id
}}
>{{replaceEmoji
- (htmlSafe this.user.featured_topic.fancy_title)
+ (trustHTML this.user.featured_topic.fancy_title)
}}</LinkTo>
</div>
</div>
diff --git a/frontend/discourse/app/components/user-fields/confirm.gjs b/frontend/discourse/app/components/user-fields/confirm.gjs
index beadf2158e2..7808a50e28c 100644
--- a/frontend/discourse/app/components/user-fields/confirm.gjs
+++ b/frontend/discourse/app/components/user-fields/confirm.gjs
@@ -1,6 +1,6 @@
import { Input } from "@ember/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import InputTip from "discourse/components/input-tip";
import { i18n } from "discourse-i18n";
import UserFieldBase from "./base";
@@ -28,7 +28,7 @@ export default class UserFieldConfirm extends UserFieldBase {
@type="checkbox"
/>
<span>
- {{htmlSafe this.field.description}}
+ {{trustHTML this.field.description}}
{{#unless this.field.name}}{{#if this.field.required}}<span
class="required"
>*</span>{{/if}}{{/unless}}
diff --git a/frontend/discourse/app/components/user-fields/date.gjs b/frontend/discourse/app/components/user-fields/date.gjs
index e219daa9551..1fe4485f40e 100644
--- a/frontend/discourse/app/components/user-fields/date.gjs
+++ b/frontend/discourse/app/components/user-fields/date.gjs
@@ -1,6 +1,6 @@
import { Input } from "@ember/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import InputTip from "discourse/components/input-tip";
import { i18n } from "discourse-i18n";
import UserFieldBase from "./base";
@@ -24,7 +24,7 @@ export default class UserFieldDate extends UserFieldBase {
{{#if this.validation.failed}}
<InputTip @validation={{this.validation}} />
{{else}}
- <div class="instructions">{{htmlSafe this.field.description}}</div>
+ <div class="instructions">{{trustHTML this.field.description}}</div>
{{/if}}
</div>
</template>
diff --git a/frontend/discourse/app/components/user-fields/dropdown.gjs b/frontend/discourse/app/components/user-fields/dropdown.gjs
index 67fa2035922..3b5c2f8296d 100644
--- a/frontend/discourse/app/components/user-fields/dropdown.gjs
+++ b/frontend/discourse/app/components/user-fields/dropdown.gjs
@@ -1,5 +1,5 @@
import { concat, fn, hash } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import InputTip from "discourse/components/input-tip";
import ComboBox from "discourse/select-kit/components/combo-box";
import { i18n } from "discourse-i18n";
@@ -29,7 +29,7 @@ export default class UserFieldDropdown extends UserFieldBase {
{{#if this.validation.failed}}
<InputTip @validation={{this.validation}} />
{{else}}
- <div class="instructions">{{htmlSafe this.field.description}}</div>
+ <div class="instructions">{{trustHTML this.field.description}}</div>
{{/if}}
</div>
</template>
diff --git a/frontend/discourse/app/components/user-fields/multiselect.gjs b/frontend/discourse/app/components/user-fields/multiselect.gjs
index 70f458590a3..5f3ac9a5327 100644
--- a/frontend/discourse/app/components/user-fields/multiselect.gjs
+++ b/frontend/discourse/app/components/user-fields/multiselect.gjs
@@ -1,5 +1,5 @@
import { concat, fn, hash } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import InputTip from "discourse/components/input-tip";
import MultiSelect from "discourse/select-kit/components/multi-select";
import { i18n } from "discourse-i18n";
@@ -29,7 +29,7 @@ export default class UserFieldMultiselect extends UserFieldBase {
{{#if this.validation.failed}}
<InputTip @validation={{this.validation}} />
{{else}}
- <div class="instructions">{{htmlSafe this.field.description}}</div>
+ <div class="instructions">{{trustHTML this.field.description}}</div>
{{/if}}
</div>
</template>
diff --git a/frontend/discourse/app/components/user-fields/text.gjs b/frontend/discourse/app/components/user-fields/text.gjs
index 6709c39d342..2f8b1212a10 100644
--- a/frontend/discourse/app/components/user-fields/text.gjs
+++ b/frontend/discourse/app/components/user-fields/text.gjs
@@ -1,6 +1,6 @@
import { Input } from "@ember/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import InputTip from "discourse/components/input-tip";
import { i18n } from "discourse-i18n";
import UserFieldBase from "./base";
@@ -24,7 +24,7 @@ export default class UserFieldText extends UserFieldBase {
{{#if this.validation.failed}}
<InputTip @validation={{this.validation}} />
{{else}}
- <div class="instructions">{{htmlSafe this.field.description}}</div>
+ <div class="instructions">{{trustHTML this.field.description}}</div>
{{/if}}
</div>
</template>
diff --git a/frontend/discourse/app/components/user-fields/textarea.gjs b/frontend/discourse/app/components/user-fields/textarea.gjs
index 7617c24ef5d..d259518c76d 100644
--- a/frontend/discourse/app/components/user-fields/textarea.gjs
+++ b/frontend/discourse/app/components/user-fields/textarea.gjs
@@ -1,6 +1,6 @@
import { Textarea } from "@ember/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import InputTip from "discourse/components/input-tip";
import { i18n } from "discourse-i18n";
import UserFieldBase from "./base";
@@ -25,7 +25,7 @@ export default class UserFieldTextArea extends UserFieldBase {
{{#if this.validation.failed}}
<InputTip @validation={{this.validation}} />
{{else}}
- <div class="instructions">{{htmlSafe this.field.description}}</div>
+ <div class="instructions">{{trustHTML this.field.description}}</div>
{{/if}}
</div>
</template>
diff --git a/frontend/discourse/app/components/user-menu/bookmarks-list-empty-state.gjs b/frontend/discourse/app/components/user-menu/bookmarks-list-empty-state.gjs
index 5ef2ac7ce2f..665aa36dfdc 100644
--- a/frontend/discourse/app/components/user-menu/bookmarks-list-empty-state.gjs
+++ b/frontend/discourse/app/components/user-menu/bookmarks-list-empty-state.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import EmptyState from "discourse/components/empty-state";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
@@ -6,7 +6,7 @@ import { i18n } from "discourse-i18n";
const BookmarksListEmptyState = <template>
<EmptyState
@title={{i18n "user.no_bookmarks_title"}}
- @body={{htmlSafe (i18n "user.no_bookmarks_body" icon=(icon "bookmark"))}}
+ @body={{trustHTML (i18n "user.no_bookmarks_body" icon=(icon "bookmark"))}}
/>
</template>;
diff --git a/frontend/discourse/app/components/user-menu/likes-list-empty-state.gjs b/frontend/discourse/app/components/user-menu/likes-list-empty-state.gjs
index 151cc244e36..531981ef17f 100644
--- a/frontend/discourse/app/components/user-menu/likes-list-empty-state.gjs
+++ b/frontend/discourse/app/components/user-menu/likes-list-empty-state.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import EmptyState from "discourse/components/empty-state";
import getUrl from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
@@ -6,7 +6,7 @@ import { i18n } from "discourse-i18n";
const LikesListEmptyState = <template>
<EmptyState
@title={{i18n "user.no_likes_title"}}
- @body={{htmlSafe
+ @body={{trustHTML
(i18n
"user.no_likes_body"
preferencesUrl=(getUrl "/my/preferences/notifications")
diff --git a/frontend/discourse/app/components/user-menu/messages-list-empty-state.gjs b/frontend/discourse/app/components/user-menu/messages-list-empty-state.gjs
index 08b0df07926..d51c3f145d1 100644
--- a/frontend/discourse/app/components/user-menu/messages-list-empty-state.gjs
+++ b/frontend/discourse/app/components/user-menu/messages-list-empty-state.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import EmptyState from "discourse/components/empty-state";
import icon from "discourse/helpers/d-icon";
import getUrl from "discourse/lib/get-url";
@@ -7,7 +7,7 @@ import { i18n } from "discourse-i18n";
const MessagesListEmptyState = <template>
<EmptyState
@title={{i18n "user.no_messages_title"}}
- @body={{htmlSafe
+ @body={{trustHTML
(i18n
"user.no_messages_body"
icon=(icon "envelope")
diff --git a/frontend/discourse/app/components/user-menu/notifications-list-empty-state.gjs b/frontend/discourse/app/components/user-menu/notifications-list-empty-state.gjs
index 695df418f71..a0666dbdf8d 100644
--- a/frontend/discourse/app/components/user-menu/notifications-list-empty-state.gjs
+++ b/frontend/discourse/app/components/user-menu/notifications-list-empty-state.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import EmptyState from "discourse/components/empty-state";
import icon from "discourse/helpers/d-icon";
import getUrl from "discourse/lib/get-url";
@@ -7,7 +7,7 @@ import { i18n } from "discourse-i18n";
const NotificationsListEmptyState = <template>
<EmptyState
@title={{i18n "user.no_notifications_title"}}
- @body={{htmlSafe
+ @body={{trustHTML
(i18n
"user.no_notifications_body"
icon=(icon "bell")
diff --git a/frontend/discourse/app/components/user-menu/other-notifications-list-empty-state.gjs b/frontend/discourse/app/components/user-menu/other-notifications-list-empty-state.gjs
index 31307b54cd2..3abdabce2e4 100644
--- a/frontend/discourse/app/components/user-menu/other-notifications-list-empty-state.gjs
+++ b/frontend/discourse/app/components/user-menu/other-notifications-list-empty-state.gjs
@@ -1,11 +1,11 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import EmptyState from "discourse/components/empty-state";
import { i18n } from "discourse-i18n";
const OtherNotificationsListEmptyState = <template>
<EmptyState
@title={{i18n "user.no_other_notifications_title"}}
- @body={{htmlSafe (i18n "user.no_other_notifications_body")}}
+ @body={{trustHTML (i18n "user.no_other_notifications_body")}}
/>
</template>;
diff --git a/frontend/discourse/app/components/user-preferences/user-passkeys.gjs b/frontend/discourse/app/components/user-preferences/user-passkeys.gjs
index 1e3940edf1a..a50b2a6fe03 100644
--- a/frontend/discourse/app/components/user-preferences/user-passkeys.gjs
+++ b/frontend/discourse/app/components/user-preferences/user-passkeys.gjs
@@ -3,7 +3,7 @@ import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { schedule } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import ConfirmSession from "discourse/components/dialog-messages/confirm-session";
import PasskeyOptionsDropdown from "discourse/components/user-preferences/passkey-options-dropdown";
@@ -192,7 +192,7 @@ export default class UserPasskeys extends Component {
<div class="passkey-left">
<div class="row-passkey__name">{{passkey.name}}</div>
<div class="row-passkey__created-date">
- {{htmlSafe
+ {{trustHTML
(i18n
"user.passkeys.added_date"
date=(formatDate
@@ -203,7 +203,7 @@ export default class UserPasskeys extends Component {
</div>
<div class="row-passkey__used-date">
{{#if passkey.last_used}}
- {{htmlSafe
+ {{trustHTML
(i18n
"user.passkeys.last_used_date"
date=(formatDate
diff --git a/frontend/discourse/app/components/user-stat.gjs b/frontend/discourse/app/components/user-stat.gjs
index c8f03bb3119..e44bc324ad6 100644
--- a/frontend/discourse/app/components/user-stat.gjs
+++ b/frontend/discourse/app/components/user-stat.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
import formatDuration from "discourse/helpers/format-duration";
import number from "discourse/helpers/number";
@@ -31,7 +31,7 @@ export default class UserStat extends Component {
</span>
<span class="label">
{{#if @icon}}{{icon @icon}}{{/if}}
- {{htmlSafe (i18n @label count=@value)}}
+ {{trustHTML (i18n @label count=@value)}}
</span>
</div>
</template>
diff --git a/frontend/discourse/app/components/user-summary-topic.gjs b/frontend/discourse/app/components/user-summary-topic.gjs
index 32a1de91c35..b4216502e1e 100644
--- a/frontend/discourse/app/components/user-summary-topic.gjs
+++ b/frontend/discourse/app/components/user-summary-topic.gjs
@@ -1,6 +1,6 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import PluginOutlet from "discourse/components/plugin-outlet";
import icon from "discourse/helpers/d-icon";
@@ -31,7 +31,7 @@ export default class UserSummaryTopic extends Component {
{{/if}}
</span>
<br />
- <a href={{@url}}>{{htmlSafe @topic.fancyTitle}}</a>
+ <a href={{@url}}>{{trustHTML @topic.fancyTitle}}</a>
</PluginOutlet>
</li>
</template>
diff --git a/frontend/discourse/app/components/user-tip-container.gjs b/frontend/discourse/app/components/user-tip-container.gjs
index 4ca12cca67f..2678b4e1965 100644
--- a/frontend/discourse/app/components/user-tip-container.gjs
+++ b/frontend/discourse/app/components/user-tip-container.gjs
@@ -2,14 +2,14 @@ import Component from "@glimmer/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
export default class UserTipContainer extends Component {
@service userTips;
get safeHtmlContent() {
- return htmlSafe(this.args.data.contentHtml);
+ return trustHTML(this.args.data.contentHtml);
}
get showSkipButton() {
diff --git a/frontend/discourse/app/components/username-preference.gjs b/frontend/discourse/app/components/username-preference.gjs
index d3746a265e1..a128a2b223f 100644
--- a/frontend/discourse/app/components/username-preference.gjs
+++ b/frontend/discourse/app/components/username-preference.gjs
@@ -6,7 +6,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { empty, or } from "@ember/object/computed";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import DButton from "discourse/components/d-button";
import DModalCancel from "discourse/components/d-modal-cancel";
@@ -157,7 +157,7 @@ export default class UsernamePreference extends Component {
{{#if this.siteSettings.enable_mentions}}
<div class="instructions">
- {{htmlSafe
+ {{trustHTML
(i18n "user.username.short_instructions" [email protected])
}}
</div>
diff --git a/frontend/discourse/app/components/welcome-banner.gjs b/frontend/discourse/app/components/welcome-banner.gjs
index 77abc7d8706..d8ace240b60 100644
--- a/frontend/discourse/app/components/welcome-banner.gjs
+++ b/frontend/discourse/app/components/welcome-banner.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
import { dasherize } from "@ember/string";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -178,7 +178,7 @@ export default class WelcomeBanner extends Component {
get bgImgStyle() {
if (this.siteSettings.welcome_banner_image) {
- return htmlSafe(
+ return trustHTML(
`background-image:url(${escapeExpression(
this.siteSettings.welcome_banner_image
)});`
@@ -191,7 +191,7 @@ export default class WelcomeBanner extends Component {
this.siteSettings.welcome_banner_image &&
this.siteSettings.welcome_banner_text_color
) {
- return htmlSafe(
+ return trustHTML(
`color:${escapeExpression(this.siteSettings.welcome_banner_text_color)};`
);
}
@@ -217,10 +217,10 @@ export default class WelcomeBanner extends Component {
class="welcome-banner__title"
style={{if this.textColorStyle this.textColorStyle}}
>
- {{htmlSafe this.headerText}}
+ {{trustHTML this.headerText}}
{{#if this.subheaderText}}
<p class="welcome-banner__subheader">
- {{htmlSafe this.subheaderText}}
+ {{trustHTML this.subheaderText}}
</p>
{{/if}}
</div>
diff --git a/frontend/discourse/app/controllers/login.js b/frontend/discourse/app/controllers/login.js
index 1ef262100fc..d73e6d7f8ac 100644
--- a/frontend/discourse/app/controllers/login.js
+++ b/frontend/discourse/app/controllers/login.js
@@ -2,7 +2,7 @@ import { tracked } from "@glimmer/tracking";
import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import NotActivatedModal from "discourse/components/modal/not-activated";
import { ajax } from "discourse/lib/ajax";
@@ -244,7 +244,7 @@ export default class LoginPageController extends Controller {
} else if (result.reason === "suspended") {
this.dialog.alert(result.error);
} else if (result.reason === "expired") {
- this.flash = htmlSafe(
+ this.flash = trustHTML(
i18n("login.password_expired", {
reset_url: getURL("/password-reset"),
})
diff --git a/frontend/discourse/app/controllers/user-activity/bookmarks.js b/frontend/discourse/app/controllers/user-activity/bookmarks.js
index 62c2f876093..ceff1b5a215 100644
--- a/frontend/discourse/app/controllers/user-activity/bookmarks.js
+++ b/frontend/discourse/app/controllers/user-activity/bookmarks.js
@@ -3,7 +3,7 @@ import EmberObject, { action, computed } from "@ember/object";
import { dependentKeyCompat } from "@ember/object/compat";
import { notEmpty } from "@ember/object/computed";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax";
import BulkSelectHelper from "discourse/lib/bulk-select-helper";
@@ -43,7 +43,7 @@ export default class UserActivityBookmarksController extends Controller {
@computed()
get emptyStateBody() {
- return htmlSafe(
+ return trustHTML(
i18n("user.no_bookmarks_body", {
icon: iconHTML("bookmark"),
})
diff --git a/frontend/discourse/app/controllers/user-notifications.js b/frontend/discourse/app/controllers/user-notifications.js
index 25d68443335..0fe75957581 100644
--- a/frontend/discourse/app/controllers/user-notifications.js
+++ b/frontend/discourse/app/controllers/user-notifications.js
@@ -3,7 +3,7 @@ import Controller from "@ember/controller";
import { action } from "@ember/object";
import { getOwner } from "@ember/owner";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import curryComponent from "ember-curry-component";
import DismissNotificationConfirmationModal from "discourse/components/modal/dismiss-notification-confirmation";
import RelativeDate from "discourse/components/relative-date";
@@ -68,7 +68,7 @@ export default class UserNotificationsController extends Controller {
}
get emptyStateBody() {
- return htmlSafe(
+ return trustHTML(
i18n("user.no_notifications_page_body", {
preferencesUrl: getURL("/my/preferences/notifications"),
icon: iconHTML("bell"),
diff --git a/frontend/discourse/app/controllers/user-private-messages.js b/frontend/discourse/app/controllers/user-private-messages.js
index 96c11fc0cf8..de4d571c626 100644
--- a/frontend/discourse/app/controllers/user-private-messages.js
+++ b/frontend/discourse/app/controllers/user-private-messages.js
@@ -3,7 +3,7 @@ import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import { alias, and, equal, readOnly } from "@ember/object/computed";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DiscourseURL from "discourse/lib/url";
import { i18n } from "discourse-i18n";
@@ -85,7 +85,7 @@ export default class extends Controller {
);
}, userMsgsCount);
if (userMsgsCount && this.showCount) {
- inboxName = htmlSafe(`${inboxName}&nbsp;(${userMsgsCount})`);
+ inboxName = trustHTML(`${inboxName}&nbsp;(${userMsgsCount})`);
}
const content = [
{
@@ -108,7 +108,7 @@ export default class extends Controller {
);
}, groupMsgsCount);
if (groupMsgsCount && this.showCount) {
- groupName = htmlSafe(`${name}&nbsp;(${groupMsgsCount})`);
+ groupName = trustHTML(`${name}&nbsp;(${groupMsgsCount})`);
}
content.push({
id: this.router.urlFor(
diff --git a/frontend/discourse/app/form-kit/components/fk/control/code.gjs b/frontend/discourse/app/form-kit/components/fk/control/code.gjs
index 6eb26097d28..db5b7a4560a 100644
--- a/frontend/discourse/app/form-kit/components/fk/control/code.gjs
+++ b/frontend/discourse/app/form-kit/components/fk/control/code.gjs
@@ -1,5 +1,5 @@
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AceEditor from "discourse/components/ace-editor";
import FKBaseControl from "discourse/form-kit/components/fk/control/base";
import { escapeExpression } from "discourse/lib/utilities";
@@ -19,7 +19,7 @@ export default class FKControlCode extends FKBaseControl {
return;
}
- return htmlSafe(`height: ${escapeExpression(this.args.height)}px`);
+ return trustHTML(`height: ${escapeExpression(this.args.height)}px`);
}
<template>
diff --git a/frontend/discourse/app/form-kit/components/fk/control/color.gjs b/frontend/discourse/app/form-kit/components/fk/control/color.gjs
index 26a06814167..70ac19d6b53 100644
--- a/frontend/discourse/app/form-kit/components/fk/control/color.gjs
+++ b/frontend/discourse/app/form-kit/components/fk/control/color.gjs
@@ -2,7 +2,7 @@ import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DMenu from "discourse/float-kit/components/d-menu";
import FKBaseControl from "discourse/form-kit/components/fk/control/base";
import concatClass from "discourse/helpers/concat-class";
@@ -22,7 +22,7 @@ function isColorUsed(usedColors, color) {
}
function colorStyle(color) {
- return htmlSafe(`background-color: #${color};`);
+ return trustHTML(`background-color: #${color};`);
}
function colorLabel(usedColors, color) {
diff --git a/frontend/discourse/app/form-kit/components/fk/control/composer.gjs b/frontend/discourse/app/form-kit/components/fk/control/composer.gjs
index 494d9145562..f8d8daa76fa 100644
--- a/frontend/discourse/app/form-kit/components/fk/control/composer.gjs
+++ b/frontend/discourse/app/form-kit/components/fk/control/composer.gjs
@@ -1,5 +1,5 @@
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DEditor from "discourse/components/d-editor";
import FKBaseControl from "discourse/form-kit/components/fk/control/base";
import concatClass from "discourse/helpers/concat-class";
@@ -18,7 +18,7 @@ export default class FKControlComposer extends FKBaseControl {
return;
}
- return htmlSafe(`height: ${escapeExpression(this.args.height)}px`);
+ return trustHTML(`height: ${escapeExpression(this.args.height)}px`);
}
<template>
diff --git a/frontend/discourse/app/form-kit/components/fk/control/textarea.gjs b/frontend/discourse/app/form-kit/components/fk/control/textarea.gjs
index a0727624dcb..b9d888e0b17 100644
--- a/frontend/discourse/app/form-kit/components/fk/control/textarea.gjs
+++ b/frontend/discourse/app/form-kit/components/fk/control/textarea.gjs
@@ -1,6 +1,6 @@
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import FKBaseControl from "discourse/form-kit/components/fk/control/base";
import { escapeExpression } from "discourse/lib/utilities";
@@ -37,7 +37,7 @@ export default class FKControlTextarea extends FKBaseControl {
return;
}
- return htmlSafe(`height: ${escapeExpression(this.args.height)}px`);
+ return trustHTML(`height: ${escapeExpression(this.args.height)}px`);
}
<template>
diff --git a/frontend/discourse/app/helpers/age-with-tooltip.js b/frontend/discourse/app/helpers/age-with-tooltip.js
index ebbaef1fb03..120fb859c62 100644
--- a/frontend/discourse/app/helpers/age-with-tooltip.js
+++ b/frontend/discourse/app/helpers/age-with-tooltip.js
@@ -1,8 +1,8 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
export default function ageWithTooltip(dt, params = {}) {
- return htmlSafe(
+ return trustHTML(
autoUpdatingRelativeAge(new Date(dt), {
...params,
title: params.title ?? true,
diff --git a/frontend/discourse/app/helpers/avatar.js b/frontend/discourse/app/helpers/avatar.js
index fc525e11afc..41228c40333 100644
--- a/frontend/discourse/app/helpers/avatar.js
+++ b/frontend/discourse/app/helpers/avatar.js
@@ -1,5 +1,5 @@
import { get } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { avatarImg } from "discourse/lib/avatar-utils";
import { prioritizeNameInUx } from "discourse/lib/settings";
import { formatUsername } from "discourse/lib/utilities";
@@ -81,5 +81,5 @@ export function renderAvatar(user, options) {
}
export default function avatar(user, params) {
- return htmlSafe(renderAvatar.call(this, user, params));
+ return trustHTML(renderAvatar.call(this, user, params));
}
diff --git a/frontend/discourse/app/helpers/border-color.js b/frontend/discourse/app/helpers/border-color.js
index 546c55a5468..d04dc1897d5 100644
--- a/frontend/discourse/app/helpers/border-color.js
+++ b/frontend/discourse/app/helpers/border-color.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
const validDirections = ["top", "right", "bottom", "left"];
@@ -8,5 +8,5 @@ export default function borderColor(color, direction) {
? `border-${direction}-color`
: "border-color";
- return htmlSafe(`${borderProperty}: #${color} `);
+ return trustHTML(`${borderProperty}: #${color} `);
}
diff --git a/frontend/discourse/app/helpers/bound-avatar-template.js b/frontend/discourse/app/helpers/bound-avatar-template.js
index 56bfe1e95e8..acdde3c5ed3 100644
--- a/frontend/discourse/app/helpers/bound-avatar-template.js
+++ b/frontend/discourse/app/helpers/bound-avatar-template.js
@@ -1,11 +1,11 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { avatarImg } from "discourse/lib/avatar-utils";
export default function boundAvatarTemplate(avatarTemplate, size, options) {
if (isEmpty(avatarTemplate)) {
- return htmlSafe("<div class='avatar-placeholder'></div>");
+ return trustHTML("<div class='avatar-placeholder'></div>");
} else {
- return htmlSafe(avatarImg({ size, avatarTemplate, ...options }));
+ return trustHTML(avatarImg({ size, avatarTemplate, ...options }));
}
}
diff --git a/frontend/discourse/app/helpers/bound-avatar.js b/frontend/discourse/app/helpers/bound-avatar.js
index b52a87f8a05..fedda219c8a 100644
--- a/frontend/discourse/app/helpers/bound-avatar.js
+++ b/frontend/discourse/app/helpers/bound-avatar.js
@@ -1,14 +1,14 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { addExtraUserClasses } from "discourse/helpers/user-avatar";
import { avatarImg } from "discourse/lib/avatar-utils";
export default function boundAvatar(user, size) {
if (isEmpty(user)) {
- return htmlSafe("<div class='avatar-placeholder'></div>");
+ return trustHTML("<div class='avatar-placeholder'></div>");
}
- return htmlSafe(
+ return trustHTML(
avatarImg(
addExtraUserClasses(user, { size, avatarTemplate: user.avatar_template })
)
diff --git a/frontend/discourse/app/helpers/bound-date.js b/frontend/discourse/app/helpers/bound-date.js
index 58bd1d81989..62ac5b0d40c 100644
--- a/frontend/discourse/app/helpers/bound-date.js
+++ b/frontend/discourse/app/helpers/bound-date.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import deprecated from "discourse/lib/deprecated";
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
@@ -8,7 +8,7 @@ export default function boundDate(dt) {
id: "discourse.bound-date",
});
- return htmlSafe(
+ return trustHTML(
autoUpdatingRelativeAge(new Date(dt), {
format: "medium",
title: true,
diff --git a/frontend/discourse/app/helpers/bound-i18n.js b/frontend/discourse/app/helpers/bound-i18n.js
index 8882b435450..cc250b61efe 100644
--- a/frontend/discourse/app/helpers/bound-i18n.js
+++ b/frontend/discourse/app/helpers/bound-i18n.js
@@ -1,6 +1,6 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { i18n } from "discourse-i18n";
export default function boundI18n(key, options) {
- return htmlSafe(i18n(key, options));
+ return trustHTML(i18n(key, options));
}
diff --git a/frontend/discourse/app/helpers/category-color-variable.js b/frontend/discourse/app/helpers/category-color-variable.js
index 5ac36c3a40e..89b95c23fe9 100644
--- a/frontend/discourse/app/helpers/category-color-variable.js
+++ b/frontend/discourse/app/helpers/category-color-variable.js
@@ -1,5 +1,5 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
export default function categoryColorVariable(color) {
- return htmlSafe(`--category-badge-color: #${color};`);
+ return trustHTML(`--category-badge-color: #${color};`);
}
diff --git a/frontend/discourse/app/helpers/category-link.js b/frontend/discourse/app/helpers/category-link.js
index d6a7c997691..05c1d3902f9 100644
--- a/frontend/discourse/app/helpers/category-link.js
+++ b/frontend/discourse/app/helpers/category-link.js
@@ -1,5 +1,5 @@
import { get } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import categoryVariables from "discourse/helpers/category-variables";
import replaceEmoji from "discourse/helpers/replace-emoji";
import getURL from "discourse/lib/get-url";
@@ -118,7 +118,7 @@ export function categoryLinkHTML(category, options) {
categoryOptions.emoji = options.emoji;
}
}
- return htmlSafe(categoryBadgeHTML(category, categoryOptions));
+ return trustHTML(categoryBadgeHTML(category, categoryOptions));
}
export default categoryLinkHTML;
diff --git a/frontend/discourse/app/helpers/category-variables.js b/frontend/discourse/app/helpers/category-variables.js
index bfb50e3a48e..0bb21275df2 100644
--- a/frontend/discourse/app/helpers/category-variables.js
+++ b/frontend/discourse/app/helpers/category-variables.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
export default function categoryVariables(category) {
let vars = "";
@@ -19,5 +19,5 @@ export default function categoryVariables(category) {
vars += `--parent-category-badge-text-color: #${category.parentCategory.textColor};`;
}
- return htmlSafe(vars);
+ return trustHTML(vars);
}
diff --git a/frontend/discourse/app/helpers/custom-html.js b/frontend/discourse/app/helpers/custom-html.js
index cefb1a20353..7dd612e9805 100644
--- a/frontend/discourse/app/helpers/custom-html.js
+++ b/frontend/discourse/app/helpers/custom-html.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PreloadStore from "discourse/lib/preload-store";
let _customizations = {};
@@ -6,12 +6,12 @@ let _customizations = {};
export function getCustomHTML(key) {
const c = _customizations[key];
if (c) {
- return htmlSafe(c);
+ return trustHTML(c);
}
const html = PreloadStore.get("customHTML");
if (html && html[key] && html[key].length) {
- return htmlSafe(html[key]);
+ return trustHTML(html[key]);
}
}
diff --git a/frontend/discourse/app/helpers/d-icon.js b/frontend/discourse/app/helpers/d-icon.js
index 0059a8a1dee..cc588630b5a 100644
--- a/frontend/discourse/app/helpers/d-icon.js
+++ b/frontend/discourse/app/helpers/d-icon.js
@@ -1,6 +1,6 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { renderIcon } from "discourse/lib/icon-library";
export default function icon(id, options = {}) {
- return htmlSafe(renderIcon("string", id, options));
+ return trustHTML(renderIcon("string", id, options));
}
diff --git a/frontend/discourse/app/helpers/dash-if-empty.js b/frontend/discourse/app/helpers/dash-if-empty.js
index 645f778cc91..dea1be464f0 100644
--- a/frontend/discourse/app/helpers/dash-if-empty.js
+++ b/frontend/discourse/app/helpers/dash-if-empty.js
@@ -1,6 +1,6 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
export default function dashIfEmpty(str) {
- return isEmpty(str) ? htmlSafe("&mdash;") : str;
+ return isEmpty(str) ? trustHTML("&mdash;") : str;
}
diff --git a/frontend/discourse/app/helpers/decorate-username-selector.js b/frontend/discourse/app/helpers/decorate-username-selector.js
index 3c000b811ca..b86df45ef98 100644
--- a/frontend/discourse/app/helpers/decorate-username-selector.js
+++ b/frontend/discourse/app/helpers/decorate-username-selector.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
let usernameDecorators = [];
export function addUsernameSelectorDecorator(decorator) {
@@ -16,7 +16,7 @@ export function decorateUsername(username) {
decorations.push(decorator(username));
});
- return decorations.length ? htmlSafe(decorations.join("")) : "";
+ return decorations.length ? trustHTML(decorations.join("")) : "";
}
export default function decorateUsernameSelector(username) {
diff --git a/frontend/discourse/app/helpers/dir-span.js b/frontend/discourse/app/helpers/dir-span.js
index 590745f7c23..52142f3569c 100644
--- a/frontend/discourse/app/helpers/dir-span.js
+++ b/frontend/discourse/app/helpers/dir-span.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { helperContext } from "discourse/lib/helpers";
import { escapeExpression } from "discourse/lib/utilities";
@@ -15,5 +15,5 @@ export default function dirSpan(str, params = {}) {
isHtmlSafe = params.htmlSafe === "true";
}
let text = isHtmlSafe ? str : escapeExpression(str);
- return htmlSafe(setDir(text));
+ return trustHTML(setDir(text));
}
diff --git a/frontend/discourse/app/helpers/directory-item-label.js b/frontend/discourse/app/helpers/directory-item-label.js
index 41747ddf8f8..c3ffc5fd864 100644
--- a/frontend/discourse/app/helpers/directory-item-label.js
+++ b/frontend/discourse/app/helpers/directory-item-label.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { i18n } from "discourse-i18n";
export default function directoryItemLabel(args) {
@@ -6,5 +6,5 @@ export default function directoryItemLabel(args) {
const count = args.item.get(args.column.name);
const translationPrefix =
args.column.type === "automatic" ? "directory." : "";
- return htmlSafe(i18n(`${translationPrefix}${args.column.name}`, { count }));
+ return trustHTML(i18n(`${translationPrefix}${args.column.name}`, { count }));
}
diff --git a/frontend/discourse/app/helpers/directory-item-value.js b/frontend/discourse/app/helpers/directory-item-value.js
index b0867b60c1b..1565ce42caf 100644
--- a/frontend/discourse/app/helpers/directory-item-value.js
+++ b/frontend/discourse/app/helpers/directory-item-value.js
@@ -1,9 +1,9 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { number } from "discourse/lib/formatter";
export default function directoryItemValue(args) {
// Args should include key/values { item, column }
- return htmlSafe(
+ return trustHTML(
`<span class='directory-table__value'>${number(
args.item.get(args.column.name)
)}</span>`
diff --git a/frontend/discourse/app/helpers/directory-table-header-title.js b/frontend/discourse/app/helpers/directory-table-header-title.js
index 6eaf86fa3ab..46e52526a11 100644
--- a/frontend/discourse/app/helpers/directory-table-header-title.js
+++ b/frontend/discourse/app/helpers/directory-table-header-title.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { iconHTML } from "discourse/lib/icon-library";
import { i18n } from "discourse-i18n";
@@ -14,5 +14,5 @@ export default function directoryTableHeaderTitle(args) {
html += args.translated
? args.field
: i18n(`${labelKey}_long`, { defaultValue: i18n(labelKey) });
- return htmlSafe(html);
+ return trustHTML(html);
}
diff --git a/frontend/discourse/app/helpers/discourse-tag.js b/frontend/discourse/app/helpers/discourse-tag.js
index 9fa0cb17968..e422755f95a 100644
--- a/frontend/discourse/app/helpers/discourse-tag.js
+++ b/frontend/discourse/app/helpers/discourse-tag.js
@@ -1,6 +1,6 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import renderTag from "discourse/lib/render-tag";
export default function discourseTag(name, params) {
- return htmlSafe(renderTag(name, params));
+ return trustHTML(renderTag(name, params));
}
diff --git a/frontend/discourse/app/helpers/discourse-tags.js b/frontend/discourse/app/helpers/discourse-tags.js
index 07debbdc56e..18e45443bef 100644
--- a/frontend/discourse/app/helpers/discourse-tags.js
+++ b/frontend/discourse/app/helpers/discourse-tags.js
@@ -1,6 +1,6 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import renderTags from "discourse/lib/render-tags";
export default function discourseTags(topic, params) {
- return htmlSafe(renderTags(topic, params));
+ return trustHTML(renderTags(topic, params));
}
diff --git a/frontend/discourse/app/helpers/emoji.js b/frontend/discourse/app/helpers/emoji.js
index 90d3da1b075..6e0bd5ae3bd 100644
--- a/frontend/discourse/app/helpers/emoji.js
+++ b/frontend/discourse/app/helpers/emoji.js
@@ -1,8 +1,8 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { emojiUnescape } from "discourse/lib/text";
import { escapeExpression } from "discourse/lib/utilities";
export default function emoji(code, options) {
const escaped = escapeExpression(`:${code}:`);
- return htmlSafe(emojiUnescape(escaped, options));
+ return trustHTML(emojiUnescape(escaped, options));
}
diff --git a/frontend/discourse/app/helpers/fa-icon.js b/frontend/discourse/app/helpers/fa-icon.js
index 87f010d5526..3cf2cfdb52c 100644
--- a/frontend/discourse/app/helpers/fa-icon.js
+++ b/frontend/discourse/app/helpers/fa-icon.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import deprecated from "discourse/lib/deprecated";
import { renderIcon } from "discourse/lib/icon-library";
@@ -10,5 +10,5 @@ export default function faIcon(icon, params) {
deprecated("Use `{{d-icon}}` instead of `{{fa-icon}}", {
id: "discourse.fa-icon",
});
- return htmlSafe(iconHTML(icon, params));
+ return trustHTML(iconHTML(icon, params));
}
diff --git a/frontend/discourse/app/helpers/format-age.js b/frontend/discourse/app/helpers/format-age.js
index a71cd93809e..ca0754ba71d 100644
--- a/frontend/discourse/app/helpers/format-age.js
+++ b/frontend/discourse/app/helpers/format-age.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import deprecated from "discourse/lib/deprecated";
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
@@ -8,5 +8,5 @@ export default function formatAge(dt) {
id: "discourse.format-age",
});
- return htmlSafe(autoUpdatingRelativeAge(new Date(dt)));
+ return trustHTML(autoUpdatingRelativeAge(new Date(dt)));
}
diff --git a/frontend/discourse/app/helpers/format-date.js b/frontend/discourse/app/helpers/format-date.js
index da53b4184bb..46d7f83afc4 100644
--- a/frontend/discourse/app/helpers/format-date.js
+++ b/frontend/discourse/app/helpers/format-date.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
/**
@@ -23,7 +23,7 @@ export default function formatDate(val, params = {}) {
if (val) {
let date = new Date(val);
- return htmlSafe(
+ return trustHTML(
autoUpdatingRelativeAge(date, {
format,
title,
diff --git a/frontend/discourse/app/helpers/format-duration.js b/frontend/discourse/app/helpers/format-duration.js
index fd53d4bd2a3..e50fd6664bd 100644
--- a/frontend/discourse/app/helpers/format-duration.js
+++ b/frontend/discourse/app/helpers/format-duration.js
@@ -1,6 +1,6 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { durationTiny } from "discourse/lib/formatter";
export default function formatDuration(seconds) {
- return htmlSafe(durationTiny(seconds));
+ return trustHTML(durationTiny(seconds));
}
diff --git a/frontend/discourse/app/helpers/html-safe.js b/frontend/discourse/app/helpers/html-safe.js
index 618b1dbbc81..03ee4135fab 100644
--- a/frontend/discourse/app/helpers/html-safe.js
+++ b/frontend/discourse/app/helpers/html-safe.js
@@ -1,5 +1,13 @@
-import { htmlSafe as emberHtmlSafe } from "@ember/template";
+import { trustHTML as emberHtmlSafe } from "@ember/template";
+import deprecated from "discourse/lib/deprecated";
export default function htmlSafe(string) {
+ deprecated(
+ "`htmlSafe` from 'discourse/helpers/html-safe' is deprecated. Use `trustHTML` from '@ember/template' instead.",
+ {
+ id: "discourse.html-safe-helper",
+ since: "2026.3.0",
+ }
+ );
return emberHtmlSafe(string);
}
diff --git a/frontend/discourse/app/helpers/icon-or-image.js b/frontend/discourse/app/helpers/icon-or-image.js
index c1af600c0f9..fb454963e9e 100644
--- a/frontend/discourse/app/helpers/icon-or-image.js
+++ b/frontend/discourse/app/helpers/icon-or-image.js
@@ -1,5 +1,5 @@
import { get } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { convertIconClass, iconHTML } from "discourse/lib/icon-library";
@@ -8,12 +8,12 @@ export default function iconOrImage(badge) {
const image = get(badge, "image");
if (!isEmpty(image)) {
- return htmlSafe(`<img src='${image}'>`);
+ return trustHTML(`<img src='${image}'>`);
}
if (isEmpty(icon)) {
return "";
}
- return htmlSafe(iconHTML(convertIconClass(icon)));
+ return trustHTML(iconHTML(convertIconClass(icon)));
}
diff --git a/frontend/discourse/app/helpers/loading-spinner.js b/frontend/discourse/app/helpers/loading-spinner.js
index 1a751523a26..e9e36570df0 100644
--- a/frontend/discourse/app/helpers/loading-spinner.js
+++ b/frontend/discourse/app/helpers/loading-spinner.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
export function renderSpinner(cssClass) {
let html = "<div class='spinner";
@@ -11,5 +11,5 @@ export function renderSpinner(cssClass) {
export const spinnerHTML = renderSpinner();
export default function loadingSpinner({ size } = {}) {
- return htmlSafe(renderSpinner(size));
+ return trustHTML(renderSpinner(size));
}
diff --git a/frontend/discourse/app/helpers/number.js b/frontend/discourse/app/helpers/number.js
index b8f378c9fec..fce5c09687a 100644
--- a/frontend/discourse/app/helpers/number.js
+++ b/frontend/discourse/app/helpers/number.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { number as numberFormatter } from "discourse/lib/formatter";
import { escapeExpression } from "discourse/lib/utilities";
import I18n, { i18n } from "discourse-i18n";
@@ -37,5 +37,5 @@ export default function number(orig, params = {}) {
result += ">" + n + "</span>";
- return htmlSafe(result);
+ return trustHTML(result);
}
diff --git a/frontend/discourse/app/helpers/period-title.js b/frontend/discourse/app/helpers/period-title.js
index 3f4435ce8fb..fa414339ab5 100644
--- a/frontend/discourse/app/helpers/period-title.js
+++ b/frontend/discourse/app/helpers/period-title.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { i18n } from "discourse-i18n";
const TITLE_SUBS = {
@@ -17,7 +17,7 @@ export default function periodTitle(
const title = i18n("filters.top." + (TITLE_SUBS[period] || "this_week"));
if (!showDateRange) {
- return htmlSafe(title);
+ return trustHTML(title);
}
let dateString = "";
@@ -83,7 +83,7 @@ export default function periodTitle(
break;
}
- return htmlSafe(
+ return trustHTML(
`<span class="date-section">${title}</span><span class='top-date-string'>${dateString}</span>`
);
}
diff --git a/frontend/discourse/app/helpers/raw-date.js b/frontend/discourse/app/helpers/raw-date.js
index d0d96fda911..29be91bd35e 100644
--- a/frontend/discourse/app/helpers/raw-date.js
+++ b/frontend/discourse/app/helpers/raw-date.js
@@ -1,6 +1,6 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { longDate } from "discourse/lib/formatter";
export default function rawDate(dt) {
- return htmlSafe(longDate(new Date(dt)));
+ return trustHTML(longDate(new Date(dt)));
}
diff --git a/frontend/discourse/app/helpers/replace-emoji.js b/frontend/discourse/app/helpers/replace-emoji.js
index 90ab9bd58c4..71636aa1f0e 100644
--- a/frontend/discourse/app/helpers/replace-emoji.js
+++ b/frontend/discourse/app/helpers/replace-emoji.js
@@ -1,8 +1,8 @@
-import { htmlSafe, isHTMLSafe } from "@ember/template";
+import { isHTMLSafe, trustHTML } from "@ember/template";
import { emojiUnescape } from "discourse/lib/text";
import { escapeExpression } from "discourse/lib/utilities";
export default function replaceEmoji(text, options) {
text = isHTMLSafe(text) ? text.toString() : escapeExpression(text);
- return htmlSafe(emojiUnescape(text, options));
+ return trustHTML(emojiUnescape(text, options));
}
diff --git a/frontend/discourse/app/helpers/reviewable-history-description.js b/frontend/discourse/app/helpers/reviewable-history-description.js
index 509dc4f1e8b..b5b2c06cf9c 100644
--- a/frontend/discourse/app/helpers/reviewable-history-description.js
+++ b/frontend/discourse/app/helpers/reviewable-history-description.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { htmlStatus } from "discourse/helpers/reviewable-status";
import { iconHTML } from "discourse/lib/icon-library";
import { EDITED } from "discourse/models/reviewable-history";
@@ -7,8 +7,10 @@ import { i18n } from "discourse-i18n";
export default function reviewableHistoryDescription(rh) {
switch (rh.reviewable_history_type) {
case EDITED:
- return htmlSafe(iconHTML("pencil") + " " + i18n("review.history.edited"));
+ return trustHTML(
+ iconHTML("pencil") + " " + i18n("review.history.edited")
+ );
default:
- return htmlSafe(htmlStatus(rh.status));
+ return trustHTML(htmlStatus(rh.status));
}
}
diff --git a/frontend/discourse/app/helpers/reviewable-status.js b/frontend/discourse/app/helpers/reviewable-status.js
index 0d7fe509cbc..95d722ea935 100644
--- a/frontend/discourse/app/helpers/reviewable-status.js
+++ b/frontend/discourse/app/helpers/reviewable-status.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { iconHTML } from "discourse/lib/icon-library";
import {
APPROVED,
@@ -84,7 +84,7 @@ export function newReviewableStatus(status, type) {
</div>
`;
- return htmlSafe(html);
+ return trustHTML(html);
}
export function htmlStatus(status, type) {
@@ -104,5 +104,5 @@ export function htmlStatus(status, type) {
}
export default function (status, type) {
- return htmlSafe(htmlStatus(status, type));
+ return trustHTML(htmlStatus(status, type));
}
diff --git a/frontend/discourse/app/helpers/topic-featured-link.js b/frontend/discourse/app/helpers/topic-featured-link.js
index d1c67a090c2..2dd01b93de0 100644
--- a/frontend/discourse/app/helpers/topic-featured-link.js
+++ b/frontend/discourse/app/helpers/topic-featured-link.js
@@ -1,6 +1,6 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import renderTopicFeaturedLink from "discourse/lib/render-topic-featured-link";
export default function topicFeaturedLink(topic, params) {
- return htmlSafe(renderTopicFeaturedLink(topic, params));
+ return trustHTML(renderTopicFeaturedLink(topic, params));
}
diff --git a/frontend/discourse/app/helpers/topic-link.js b/frontend/discourse/app/helpers/topic-link.js
index 1b6ee2ff1c0..2cddea31663 100644
--- a/frontend/discourse/app/helpers/topic-link.js
+++ b/frontend/discourse/app/helpers/topic-link.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
export default function topicLink(topic, args = {}) {
const title = topic.get("fancyTitle");
@@ -13,7 +13,7 @@ export default function topicLink(topic, args = {}) {
args.class.split(" ").forEach((c) => classes.push(c));
}
- return htmlSafe(
+ return trustHTML(
`<a href='${url}'
class='${classes.join(" ")}'
data-topic-id='${topic.id}'>${title}</a>`
diff --git a/frontend/discourse/app/helpers/user-status.js b/frontend/discourse/app/helpers/user-status.js
index 4450e5bfcaf..3f8ec7f6d3f 100644
--- a/frontend/discourse/app/helpers/user-status.js
+++ b/frontend/discourse/app/helpers/user-status.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { iconHTML } from "discourse/lib/icon-library";
import { escapeExpression } from "discourse/lib/utilities";
import { i18n } from "discourse-i18n";
@@ -11,7 +11,7 @@ export default function userStatus(user, { currentUser } = {}) {
const name = escapeExpression(user.name);
if (user.admin && currentUser?.staff) {
- return htmlSafe(
+ return trustHTML(
iconHTML("shield-halved", {
label: i18n("user.admin", { user: name }),
})
@@ -19,7 +19,7 @@ export default function userStatus(user, { currentUser } = {}) {
}
if (user.moderator) {
- return htmlSafe(
+ return trustHTML(
iconHTML("shield-halved", {
label: i18n("user.moderator", { user: name }),
})
diff --git a/frontend/discourse/app/lib/ajax-error.js b/frontend/discourse/app/lib/ajax-error.js
index c6184983534..9d6af2c1355 100644
--- a/frontend/discourse/app/lib/ajax-error.js
+++ b/frontend/discourse/app/lib/ajax-error.js
@@ -1,5 +1,5 @@
/* eslint-disable ember/no-jquery */
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import $ from "jquery";
import { getOwnerWithFallback } from "discourse/lib/get-owner";
import { i18n } from "discourse-i18n";
@@ -106,7 +106,7 @@ export function popupAjaxError(error) {
const errorInfo = extractErrorInfo(error);
if (errorInfo.html) {
- dialog.alert({ message: htmlSafe(errorInfo.message) });
+ dialog.alert({ message: trustHTML(errorInfo.message) });
} else {
dialog.alert(errorInfo.message);
}
diff --git a/frontend/discourse/app/lib/blocks/-internals/components/block-outlet-inline-error.gjs b/frontend/discourse/app/lib/blocks/-internals/components/block-outlet-inline-error.gjs
index 78d76f9421a..5f5608f8dc3 100644
--- a/frontend/discourse/app/lib/blocks/-internals/components/block-outlet-inline-error.gjs
+++ b/frontend/discourse/app/lib/blocks/-internals/components/block-outlet-inline-error.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import FlashMessage from "discourse/components/flash-message";
import { extractErrorInfo } from "discourse/lib/ajax-error";
@@ -15,7 +15,7 @@ export default class BlockOutletInlineError extends Component {
const errorInfo = extractErrorInfo(this.args.error, undefined, {
skipConsoleError: true,
});
- return errorInfo.html ? htmlSafe(errorInfo.message) : errorInfo.message;
+ return errorInfo.html ? trustHTML(errorInfo.message) : errorInfo.message;
}
<template>
diff --git a/frontend/discourse/app/lib/computed.js b/frontend/discourse/app/lib/computed.js
index af371623a2a..2c3b89db0ba 100644
--- a/frontend/discourse/app/lib/computed.js
+++ b/frontend/discourse/app/lib/computed.js
@@ -1,5 +1,6 @@
import { computed } from "@ember/object";
-import { htmlSafe as htmlSafeTemplateHelper } from "@ember/template";
+import { trustHTML as htmlSafeTemplateHelper } from "@ember/template";
+import deprecated from "discourse/lib/deprecated";
import getURL from "discourse/lib/get-url";
import { deepEqual } from "discourse/lib/object";
import { i18n } from "discourse-i18n";
@@ -88,13 +89,13 @@ export function computedI18n(...args) {
export { computedI18n as i18n };
/**
- Returns htmlSafe version of a string.
+ Returns trustHTML version of a string.
- @method htmlSafe
- @params {String} properties* to htmlify
+ @method trustHTML
+ @params {String} properties* to trustHTML
@return {Function} computedProperty function
**/
-export function htmlSafe(...args) {
+export function trustHTML(...args) {
return computed(...args, {
get() {
const path = args.pop();
@@ -103,6 +104,20 @@ export function htmlSafe(...args) {
});
}
+/**
+ @deprecated Use `trustHTML` instead.
+**/
+export function htmlSafe(...args) {
+ deprecated(
+ "`htmlSafe` from 'discourse/lib/computed' is deprecated. Use `trustHTML` instead.",
+ {
+ id: "discourse.computed-html-safe",
+ since: "2026.3.0",
+ }
+ );
+ return trustHTML(...args);
+}
+
/**
Uses an Ember String `fmt` call to format a string. See:
http://emberjs.com/api/classes/Ember.String.html#method_fmt
diff --git a/frontend/discourse/app/lib/hashtag-autocomplete.js b/frontend/discourse/app/lib/hashtag-autocomplete.js
index 61a019c23f7..f5f0ff32da3 100644
--- a/frontend/discourse/app/lib/hashtag-autocomplete.js
+++ b/frontend/discourse/app/lib/hashtag-autocomplete.js
@@ -1,5 +1,5 @@
import { cancel } from "@ember/runloop";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import RichHashtagAutocompleteResults from "discourse/components/rich-hashtag-autocomplete-results";
import { ajax } from "discourse/lib/ajax";
import discourseDebounce from "discourse/lib/debounce";
@@ -120,7 +120,7 @@ function _searchRequest(term, contextualHashtagConfiguration, resultFunc) {
.then((response) => {
response.results?.forEach((result) => {
// Convert :emoji: in the result text to HTML safely.
- result.text = htmlSafe(emojiUnescape(escapeExpression(result.text)));
+ result.text = trustHTML(emojiUnescape(escapeExpression(result.text)));
let opts = {
preloaded: true,
diff --git a/frontend/discourse/app/lib/helpers.js b/frontend/discourse/app/lib/helpers.js
index 3cecf00063f..a80934cd165 100644
--- a/frontend/discourse/app/lib/helpers.js
+++ b/frontend/discourse/app/lib/helpers.js
@@ -1,6 +1,6 @@
import Helper from "@ember/component/helper";
import { dasherize } from "@ember/string";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import deprecated from "discourse/lib/deprecated";
export function makeArray(obj) {
@@ -19,7 +19,7 @@ export function htmlHelper(fn) {
return Helper.helper(function (...args) {
args =
args.length > 1 ? args[0].concat({ hash: args[args.length - 1] }) : args;
- return htmlSafe(fn.apply(this, args) || "");
+ return trustHTML(fn.apply(this, args) || "");
});
}
diff --git a/frontend/discourse/app/lib/highlight-watched-words.js b/frontend/discourse/app/lib/highlight-watched-words.js
index a944c70b168..6a5c3e7f8b5 100644
--- a/frontend/discourse/app/lib/highlight-watched-words.js
+++ b/frontend/discourse/app/lib/highlight-watched-words.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { decode } from "html-entities";
import highlightHTML from "discourse/lib/highlight-html";
@@ -8,7 +8,7 @@ export default function (text, reviewable) {
}
if (!reviewable || !reviewable.reviewable_scores) {
- return htmlSafe(text);
+ return trustHTML(text);
}
const words = reviewable.reviewable_scores
@@ -18,7 +18,7 @@ export default function (text, reviewable) {
.flat();
if (!words.length) {
- return htmlSafe(text);
+ return trustHTML(text);
}
const elem = document.createElement("span");
@@ -31,5 +31,5 @@ export default function (text, reviewable) {
});
});
- return htmlSafe(decode(elem.innerHTML));
+ return trustHTML(decode(elem.innerHTML));
}
diff --git a/frontend/discourse/app/lib/notification-types/base.js b/frontend/discourse/app/lib/notification-types/base.js
index 92b4c5145c9..ea3f9053463 100644
--- a/frontend/discourse/app/lib/notification-types/base.js
+++ b/frontend/discourse/app/lib/notification-types/base.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { emojiUnescape } from "discourse/lib/text";
import { userPath } from "discourse/lib/url";
import { formatUsername, postUrl } from "discourse/lib/utilities";
@@ -86,7 +86,7 @@ export default class NotificationTypeBase {
get description() {
const description = emojiUnescape(this.notification.fancy_title);
if (description) {
- return htmlSafe(description);
+ return trustHTML(description);
} else {
return this.notification.data.topic_title;
}
diff --git a/frontend/discourse/app/lib/post-cooked-html-decorators/quote-controls.gjs b/frontend/discourse/app/lib/post-cooked-html-decorators/quote-controls.gjs
index bcf7f71f52e..37405503f37 100644
--- a/frontend/discourse/app/lib/post-cooked-html-decorators/quote-controls.gjs
+++ b/frontend/discourse/app/lib/post-cooked-html-decorators/quote-controls.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import curryComponent from "ember-curry-component";
import PostQuotedContent from "discourse/components/post/quoted-content";
@@ -47,7 +47,7 @@ export default function quoteControls(element, context) {
if (titleEl) {
// Remove existing quote controls if present
titleEl.querySelector(".quote-controls")?.remove();
- title = htmlSafe(titleEl.innerHTML);
+ title = trustHTML(titleEl.innerHTML);
}
// Get quote content
@@ -55,7 +55,7 @@ export default function quoteControls(element, context) {
// Build props for PostQuotedContent component
const componentProps = {
- collapsedContent: htmlSafe(blockquote?.innerHTML),
+ collapsedContent: trustHTML(blockquote?.innerHTML),
decoratorState,
expanded: expanded === "true",
fullQuote: full === "true",
diff --git a/frontend/discourse/app/lib/reviewable-types/flagged-post.js b/frontend/discourse/app/lib/reviewable-types/flagged-post.js
index 0818fa2878c..a7ab9a9e9b1 100644
--- a/frontend/discourse/app/lib/reviewable-types/flagged-post.js
+++ b/frontend/discourse/app/lib/reviewable-types/flagged-post.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ReviewableTypeBase from "discourse/lib/reviewable-types/base";
import { emojiUnescape } from "discourse/lib/text";
import { i18n } from "discourse-i18n";
@@ -8,7 +8,7 @@ export default class extends ReviewableTypeBase {
const title = this.reviewable.topic_fancy_title;
const postNumber = this.reviewable.post_number;
if (title && postNumber) {
- return htmlSafe(
+ return trustHTML(
i18n("user_menu.reviewable.post_number_with_topic_title", {
post_number: postNumber,
title: emojiUnescape(title),
diff --git a/frontend/discourse/app/lib/reviewable-types/queued-post.js b/frontend/discourse/app/lib/reviewable-types/queued-post.js
index d1fb8a82724..c7e8fb66381 100644
--- a/frontend/discourse/app/lib/reviewable-types/queued-post.js
+++ b/frontend/discourse/app/lib/reviewable-types/queued-post.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ReviewableTypeBase from "discourse/lib/reviewable-types/base";
import { emojiUnescape } from "discourse/lib/text";
import { escapeExpression } from "discourse/lib/utilities";
@@ -16,9 +16,9 @@ export default class extends ReviewableTypeBase {
}
title = emojiUnescape(title);
if (this.reviewable.is_new_topic) {
- return htmlSafe(title);
+ return trustHTML(title);
} else if (title) {
- return htmlSafe(
+ return trustHTML(
i18n("user_menu.reviewable.new_post_in_topic", {
title,
})
diff --git a/frontend/discourse/app/lib/sidebar/base-custom-sidebar-panel.js b/frontend/discourse/app/lib/sidebar/base-custom-sidebar-panel.js
index 04bd0d6f6bc..c0574a2861b 100644
--- a/frontend/discourse/app/lib/sidebar/base-custom-sidebar-panel.js
+++ b/frontend/discourse/app/lib/sidebar/base-custom-sidebar-panel.js
@@ -66,7 +66,7 @@ export default class BaseCustomSidebarPanel {
* @param {string} filter filter applied
*
* @returns {string | SafeString} Description displayed when the applied filter has no results.
- * Use `htmlSafe` from `from "@ember/template` to use HTML strings.
+ * Use `trustHTML` from `@ember/template` to use HTML strings.
*/
// eslint-disable-next-line no-unused-vars
filterNoResultsDescription(filter) {
diff --git a/frontend/discourse/app/lib/user-menu/bookmark-item.js b/frontend/discourse/app/lib/user-menu/bookmark-item.js
index bf3bd55ff6f..5001321810f 100644
--- a/frontend/discourse/app/lib/user-menu/bookmark-item.js
+++ b/frontend/discourse/app/lib/user-menu/bookmark-item.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import UserMenuBaseItem from "discourse/lib/user-menu/base-item";
import { NO_REMINDER_ICON } from "discourse/models/bookmark";
@@ -33,7 +33,7 @@ export default class UserMenuBookmarkItem extends UserMenuBaseItem {
}
get description() {
- return htmlSafe(this.bookmark.fancy_title);
+ return trustHTML(this.bookmark.fancy_title);
}
get topicId() {
diff --git a/frontend/discourse/app/lib/user-menu/message-item.js b/frontend/discourse/app/lib/user-menu/message-item.js
index 905e37acac9..7436f5ff3ea 100644
--- a/frontend/discourse/app/lib/user-menu/message-item.js
+++ b/frontend/discourse/app/lib/user-menu/message-item.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { emojiUnescape } from "discourse/lib/text";
import UserMenuBaseItem from "discourse/lib/user-menu/base-item";
import { postUrl } from "discourse/lib/utilities";
@@ -43,7 +43,7 @@ export default class UserMenuMessageItem extends UserMenuBaseItem {
}
get description() {
- return htmlSafe(emojiUnescape(this.message.fancy_title));
+ return trustHTML(emojiUnescape(this.message.fancy_title));
}
get topicId() {
diff --git a/frontend/discourse/app/models/posts.js b/frontend/discourse/app/models/posts.js
index 825bcfa1b05..5c39acc9339 100644
--- a/frontend/discourse/app/models/posts.js
+++ b/frontend/discourse/app/models/posts.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { ajax } from "discourse/lib/ajax";
import Category from "discourse/models/category";
import Post from "discourse/models/post";
@@ -19,7 +19,7 @@ export default class Posts extends RestModel {
const { latest_posts } = await ajax("/posts.json", { data });
return latest_posts.map((post) => {
post.category = Category.findById(post.category_id);
- post.topic_html_title = htmlSafe(post.topic_html_title);
+ post.topic_html_title = trustHTML(post.topic_html_title);
return Post.create(post);
});
}
diff --git a/frontend/discourse/app/models/site.js b/frontend/discourse/app/models/site.js
index 3fa64cd6682..5a6be256c62 100644
--- a/frontend/discourse/app/models/site.js
+++ b/frontend/discourse/app/models/site.js
@@ -3,7 +3,7 @@ import EmberObject, { computed, get } from "@ember/object";
import { dependentKeyCompat } from "@ember/object/compat";
import { alias, sort } from "@ember/object/computed";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { TrackedArray } from "@ember-compat/tracked-built-ins";
import { removeValueFromArray } from "discourse/lib/array-tools";
@@ -211,7 +211,7 @@ export default class Site extends RestModel {
if (!isEmpty(siteFields)) {
return siteFields.map((f) => {
let value = fields ? fields[f.id.toString()] : null;
- value = value || htmlSafe("&mdash;");
+ value = value || trustHTML("&mdash;");
return { name: f.name, value };
});
}
diff --git a/frontend/discourse/app/models/user.js b/frontend/discourse/app/models/user.js
index 3f6ceae61ff..13850c4fb3f 100644
--- a/frontend/discourse/app/models/user.js
+++ b/frontend/discourse/app/models/user.js
@@ -8,7 +8,7 @@ import { getOwner, setOwner } from "@ember/owner";
import { cancel } from "@ember/runloop";
import { service } from "@ember/service";
import { camelize } from "@ember/string";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { TrackedArray } from "@ember-compat/tracked-built-ins";
import { Promise } from "rsvp";
@@ -353,9 +353,9 @@ export default class User extends RestModel.extend(Evented) {
isEmpty(this.profile_background_upload_url) ||
!this.siteSettings.allow_profile_backgrounds
) {
- return htmlSafe("");
+ return trustHTML("");
}
- return htmlSafe(
+ return trustHTML(
"background-image: url(" +
getURLWithCDN(this.profile_background_upload_url) +
")"
diff --git a/frontend/discourse/app/modifiers/post-stream-viewport-tracker.js b/frontend/discourse/app/modifiers/post-stream-viewport-tracker.js
index 3a1cb59b4b5..8817659ac6b 100644
--- a/frontend/discourse/app/modifiers/post-stream-viewport-tracker.js
+++ b/frontend/discourse/app/modifiers/post-stream-viewport-tracker.js
@@ -1,5 +1,5 @@
import { cancel, schedule } from "@ember/runloop";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import discourseDebounce from "discourse/lib/debounce";
import { bind } from "discourse/lib/decorators";
@@ -456,7 +456,7 @@ export default class PostStreamViewportTracker {
// element height
return {
active: true,
- style: htmlSafe(
+ style: trustHTML(
`height:${height}px !important;` +
`margin:${margin} !important;` +
"box-sizing: border-box !important;"
diff --git a/frontend/discourse/app/routes/build-private-messages-route.js b/frontend/discourse/app/routes/build-private-messages-route.js
index aa763a12ccb..3d0124e06b6 100644
--- a/frontend/discourse/app/routes/build-private-messages-route.js
+++ b/frontend/discourse/app/routes/build-private-messages-route.js
@@ -1,5 +1,5 @@
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { findOrResetCachedTopicList } from "discourse/lib/cached-topic-list";
import getURL from "discourse/lib/get-url";
import { iconHTML } from "discourse/lib/icon-library";
@@ -103,7 +103,7 @@ export default (inboxType, path, filter) => {
emptyState() {
const title = i18n("user.no_messages_title");
const body = this.currentUser?.can_send_private_messages
- ? htmlSafe(
+ ? trustHTML(
i18n("user.no_messages_body", {
aboutUrl: getURL("/about"),
icon: iconHTML("envelope"),
diff --git a/frontend/discourse/app/routes/user-activity/index.js b/frontend/discourse/app/routes/user-activity/index.js
index 5e1007af6cf..0451ce2383e 100644
--- a/frontend/discourse/app/routes/user-activity/index.js
+++ b/frontend/discourse/app/routes/user-activity/index.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import getURL from "discourse/lib/get-url";
import { iconHTML } from "discourse/lib/icon-library";
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
@@ -13,7 +13,7 @@ export default class UserActivityIndex extends UserActivityStreamRoute {
const title = i18n("user_activity.no_activity_title");
let body = "";
if (this.isCurrentUser(user)) {
- body = htmlSafe(
+ body = trustHTML(
i18n("user_activity.no_activity_body", {
topUrl: getURL("/top"),
categoriesUrl: getURL("/categories"),
diff --git a/frontend/discourse/app/routes/user-activity/likes-given.js b/frontend/discourse/app/routes/user-activity/likes-given.js
index 934811bfad5..4015183c10e 100644
--- a/frontend/discourse/app/routes/user-activity/likes-given.js
+++ b/frontend/discourse/app/routes/user-activity/likes-given.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { iconHTML } from "discourse/lib/icon-library";
import UserAction from "discourse/models/user-action";
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
@@ -15,7 +15,7 @@ export default class UserActivityLikesGiven extends UserActivityStreamRoute {
: i18n("user_activity.no_likes_title_others", {
username: user.username,
});
- const body = htmlSafe(
+ const body = trustHTML(
i18n("user_activity.no_likes_body", {
heartIcon: iconHTML("heart"),
})
diff --git a/frontend/discourse/app/routes/user-activity/read.js b/frontend/discourse/app/routes/user-activity/read.js
index 32d7aa39101..3a323d3f495 100644
--- a/frontend/discourse/app/routes/user-activity/read.js
+++ b/frontend/discourse/app/routes/user-activity/read.js
@@ -1,5 +1,5 @@
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import getURL from "discourse/lib/get-url";
import { iconHTML } from "discourse/lib/icon-library";
import UserAction from "discourse/models/user-action";
@@ -25,7 +25,7 @@ export default class UserActivityRead extends UserTopicListRoute {
emptyState() {
const title = i18n("user_activity.no_read_topics_title");
- const body = htmlSafe(
+ const body = trustHTML(
i18n("user_activity.no_read_topics_body", {
topUrl: getURL("/top"),
categoriesUrl: getURL("/categories"),
diff --git a/frontend/discourse/app/routes/user-activity/replies.js b/frontend/discourse/app/routes/user-activity/replies.js
index 631d46bf9cf..38e5ad3258f 100644
--- a/frontend/discourse/app/routes/user-activity/replies.js
+++ b/frontend/discourse/app/routes/user-activity/replies.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import getURL from "discourse/lib/get-url";
import UserAction from "discourse/models/user-action";
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
@@ -13,7 +13,7 @@ export default class UserActivityReplies extends UserActivityStreamRoute {
let title, body;
if (this.isCurrentUser(user)) {
title = i18n("user_activity.no_replies_title");
- body = htmlSafe(
+ body = trustHTML(
i18n("user_activity.no_replies_body", {
searchUrl: getURL("/search"),
})
diff --git a/frontend/discourse/app/routes/user-activity/topics.js b/frontend/discourse/app/routes/user-activity/topics.js
index 99c1d00465e..e1f0679411f 100644
--- a/frontend/discourse/app/routes/user-activity/topics.js
+++ b/frontend/discourse/app/routes/user-activity/topics.js
@@ -1,5 +1,5 @@
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import getURL from "discourse/lib/get-url";
import UserAction from "discourse/models/user-action";
import UserTopicListRoute from "discourse/routes/user-topic-list";
@@ -29,7 +29,7 @@ export default class UserActivityTopics extends UserTopicListRoute {
let title, body;
if (this.isCurrentUser(user)) {
title = i18n("user_activity.no_topics_title");
- body = htmlSafe(
+ body = trustHTML(
i18n("user_activity.no_topics_body", {
searchUrl: getURL("/search"),
})
diff --git a/frontend/discourse/app/services/logs-notice.js b/frontend/discourse/app/services/logs-notice.js
index 723d5a91978..0288c6ae3dc 100644
--- a/frontend/discourse/app/services/logs-notice.js
+++ b/frontend/discourse/app/services/logs-notice.js
@@ -2,7 +2,7 @@
import { computed } from "@ember/object";
import { readOnly } from "@ember/object/computed";
import Service, { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { observes } from "@ember-decorators/object";
import { bind } from "discourse/lib/decorators";
@@ -81,7 +81,7 @@ export default class LogsNoticeService extends Service {
@computed("text")
get message() {
- return htmlSafe(this.text);
+ return trustHTML(this.text);
}
@computed("isEmpty", "isAdmin")
diff --git a/frontend/discourse/app/static/dev-tools/block-debug/conditions-tree.gjs b/frontend/discourse/app/static/dev-tools/block-debug/conditions-tree.gjs
index fe975308a9d..16a992c6d08 100644
--- a/frontend/discourse/app/static/dev-tools/block-debug/conditions-tree.gjs
+++ b/frontend/discourse/app/static/dev-tools/block-debug/conditions-tree.gjs
@@ -1,6 +1,6 @@
// @ts-check
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import { formatValue } from "../lib/value-formatter";
@@ -124,10 +124,10 @@ class ConditionNode extends Component {
* Calculates the CSS padding for indentation based on the node's depth.
* Each level adds 12px of left padding.
*
- * @returns {ReturnType<typeof htmlSafe>} CSS style string for padding, marked as safe for binding.
+ * @returns {ReturnType<typeof trustHTML>} CSS style string for padding, marked as safe for binding.
*/
get indentStyle() {
- return htmlSafe(`padding-left: ${this.args.item.depth * 12}px`);
+ return trustHTML(`padding-left: ${this.args.item.depth * 12}px`);
}
/**
diff --git a/frontend/discourse/app/static/dev-tools/toolbar.gjs b/frontend/discourse/app/static/dev-tools/toolbar.gjs
index 8fe17db94f6..fc87e59c979 100644
--- a/frontend/discourse/app/static/dev-tools/toolbar.gjs
+++ b/frontend/discourse/app/static/dev-tools/toolbar.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
import draggable from "discourse/modifiers/draggable";
@@ -24,7 +24,7 @@ export default class Toolbar extends Component {
get style() {
const clampedTop = Math.max(this.top, 0);
- return htmlSafe(`top: min(100dvh - ${this.ownSize}px, ${clampedTop}px);`);
+ return trustHTML(`top: min(100dvh - ${this.ownSize}px, ${clampedTop}px);`);
}
@action
diff --git a/frontend/discourse/app/static/markdown-it/index.js b/frontend/discourse/app/static/markdown-it/index.js
index 44ca57a2a2f..0c851c16fa5 100644
--- a/frontend/discourse/app/static/markdown-it/index.js
+++ b/frontend/discourse/app/static/markdown-it/index.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DiscourseMarkdownIt from "discourse-markdown-it";
import loadPluginFeatures from "./features";
import MentionsParser from "./mentions-parser";
@@ -13,7 +13,7 @@ export function buildEngine(options, omitFromDefault) {
// Use this to easily create an instance with proper options
export function cook(text, options) {
- return htmlSafe(buildEngine(options).cook(text));
+ return trustHTML(buildEngine(options).cook(text));
}
// Warm up the engine with a set of options and return a function
diff --git a/frontend/discourse/app/static/prosemirror/components/image-node-view.gjs b/frontend/discourse/app/static/prosemirror/components/image-node-view.gjs
index 7bf89c63796..26738e7b5ce 100644
--- a/frontend/discourse/app/static/prosemirror/components/image-node-view.gjs
+++ b/frontend/discourse/app/static/prosemirror/components/image-node-view.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { NodeSelection } from "prosemirror-state";
import ToolbarButtons from "discourse/components/composer/toolbar-buttons";
import { ToolbarBase } from "discourse/lib/composer/toolbar";
@@ -314,7 +314,7 @@ export default class ImageNodeView extends Component {
const scale = (this.args.node.attrs.scale ?? 100) / 100;
- return htmlSafe(`width: ${width * scale}px`);
+ return trustHTML(`width: ${width * scale}px`);
}
get isInGrid() {
diff --git a/frontend/discourse/app/static/wizard/components/wizard-field.gjs b/frontend/discourse/app/static/wizard/components/wizard-field.gjs
index ea7440652a2..2d46c81e7df 100644
--- a/frontend/discourse/app/static/wizard/components/wizard-field.gjs
+++ b/frontend/discourse/app/static/wizard/components/wizard-field.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { assert } from "@ember/debug";
import { dasherize } from "@ember/string";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import lazyHash from "discourse/helpers/lazy-hash";
import { or } from "discourse/truth-helpers";
@@ -55,7 +55,7 @@ export default class WizardFieldComponent extends Component {
{{#if @field.description}}
<div class="wizard-container__description">
- {{htmlSafe @field.description}}
+ {{trustHTML @field.description}}
</div>
{{/if}}
</label>
@@ -72,13 +72,13 @@ export default class WizardFieldComponent extends Component {
{{#if @field.errorDescription}}
<div class="wizard-container__description error">
- {{htmlSafe this.field.errorDescription}}
+ {{trustHTML this.field.errorDescription}}
</div>
{{/if}}
{{#if @field.extraDescription}}
<div class="wizard-container__description extra">
- {{htmlSafe this.field.extraDescription}}
+ {{trustHTML this.field.extraDescription}}
</div>
<PluginOutlet
diff --git a/frontend/discourse/app/templates/account-created/index.gjs b/frontend/discourse/app/templates/account-created/index.gjs
index 062421995c5..03cf4460a97 100644
--- a/frontend/discourse/app/templates/account-created/index.gjs
+++ b/frontend/discourse/app/templates/account-created/index.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ActivationControls from "discourse/components/activation-controls";
import SignupProgressBar from "discourse/components/signup-progress-bar";
import WelcomeHeader from "discourse/components/welcome-header";
@@ -7,7 +7,7 @@ export default <template>
<SignupProgressBar @step="activate" />
<WelcomeHeader @header={{@controller.welcomeTitle}} />
<div class="success-info">
- {{htmlSafe @controller.accountCreated.message}}
+ {{trustHTML @controller.accountCreated.message}}
</div>
{{#if @controller.accountCreated.show_controls}}
<ActivationControls
diff --git a/frontend/discourse/app/templates/account-created/resent.gjs b/frontend/discourse/app/templates/account-created/resent.gjs
index 897cf93b8c1..37f01c15fda 100644
--- a/frontend/discourse/app/templates/account-created/resent.gjs
+++ b/frontend/discourse/app/templates/account-created/resent.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import SignupProgressBar from "discourse/components/signup-progress-bar";
import { i18n } from "discourse-i18n";
@@ -6,7 +6,7 @@ export default <template>
<SignupProgressBar @step="activate" />
<div class="ac-message">
{{#if @controller.email}}
- {{htmlSafe
+ {{trustHTML
(i18n
"login.sent_activation_email_again" [email protected]
)
diff --git a/frontend/discourse/app/templates/badges/show.gjs b/frontend/discourse/app/templates/badges/show.gjs
index f33284769d1..205e2331f8e 100644
--- a/frontend/discourse/app/templates/badges/show.gjs
+++ b/frontend/discourse/app/templates/badges/show.gjs
@@ -1,5 +1,5 @@
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import BadgeCard from "discourse/components/badge-card";
import BadgeTitle from "discourse/components/badge-title";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
@@ -84,7 +84,7 @@ export default <template>
class="badge-info"
>
<div class="granted-on">
- {{htmlSafe
+ {{trustHTML
(i18n "badges.granted_on" date=(formatDate ub.granted_at))
}}
</div>
@@ -93,7 +93,7 @@ export default <template>
<a
class="post-link"
href="{{ub.topic.url}}/{{ub.post_number}}"
- >{{htmlSafe ub.topic.fancyTitle}}</a>
+ >{{trustHTML ub.topic.fancyTitle}}</a>
{{/if}}
</UserInfo>
{{/each}}
diff --git a/frontend/discourse/app/templates/discovery/login-required.gjs b/frontend/discourse/app/templates/discovery/login-required.gjs
index 1b841cd3600..7364a2b1bbe 100644
--- a/frontend/discourse/app/templates/discovery/login-required.gjs
+++ b/frontend/discourse/app/templates/discovery/login-required.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
import bodyClass from "discourse/helpers/body-class";
@@ -24,7 +24,7 @@ export default <template>
<PluginOutlet @name="above-static" />
<div class="login-content">
- {{htmlSafe @controller.model.html}}
+ {{trustHTML @controller.model.html}}
</div>
<PluginOutlet @name="below-static" />
diff --git a/frontend/discourse/app/templates/email-login.gjs b/frontend/discourse/app/templates/email-login.gjs
index 696714a096f..fb4848caab1 100644
--- a/frontend/discourse/app/templates/email-login.gjs
+++ b/frontend/discourse/app/templates/email-login.gjs
@@ -1,5 +1,5 @@
import { fn } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import SecondFactorForm from "discourse/components/second-factor-form";
import SecondFactorInput from "discourse/components/second-factor-input";
@@ -16,7 +16,7 @@ export default <template>
<form>
{{#if @controller.model.error}}
<div class="error-info">
- {{htmlSafe @controller.model.error}}
+ {{trustHTML @controller.model.error}}
</div>
{{/if}}
diff --git a/frontend/discourse/app/templates/exception.gjs b/frontend/discourse/app/templates/exception.gjs
index 5b6ac38341d..89098e59c99 100644
--- a/frontend/discourse/app/templates/exception.gjs
+++ b/frontend/discourse/app/templates/exception.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -14,7 +14,7 @@ export default <template>
>
<div class="container">
{{#if (and @controller.errorHtml @controller.isForbidden)}}
- <div class="not-found">{{htmlSafe @controller.errorHtml}}</div>
+ <div class="not-found">{{trustHTML @controller.errorHtml}}</div>
{{else}}
<div class="error-page">
<div class="face">:(</div>
diff --git a/frontend/discourse/app/templates/faq.gjs b/frontend/discourse/app/templates/faq.gjs
index 585688a7d65..679174f5f84 100644
--- a/frontend/discourse/app/templates/faq.gjs
+++ b/frontend/discourse/app/templates/faq.gjs
@@ -1,5 +1,5 @@
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import WatchRead from "discourse/components/watch-read";
import bodyClass from "discourse/helpers/body-class";
@@ -11,7 +11,7 @@ export default <template>
<WatchRead>
<div class="contents clearfix body-page">
<PluginOutlet @name="above-static" />
- {{htmlSafe @controller.model.html}}
+ {{trustHTML @controller.model.html}}
<PluginOutlet @name="below-static" />
</div>
</WatchRead>
diff --git a/frontend/discourse/app/templates/full-page-search.gjs b/frontend/discourse/app/templates/full-page-search.gjs
index cfe441d5f62..8a59fd7f6cd 100644
--- a/frontend/discourse/app/templates/full-page-search.gjs
+++ b/frontend/discourse/app/templates/full-page-search.gjs
@@ -1,7 +1,7 @@
import { Input } from "@ember/component";
import { fn, hash } from "@ember/helper";
import { on } from "@ember/modifier";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import GoogleSearch from "discourse/components/google-search";
@@ -39,7 +39,7 @@ export default <template>
<h1 class="search-page-heading">
{{#if @controller.hasResults}}
<div class="result-count" id="search-result-count" aria-live="polite">
- {{htmlSafe @controller.resultCountLabel}}
+ {{trustHTML @controller.resultCountLabel}}
</div>
{{else}}
<div class="search-page-heading__page-title">
diff --git a/frontend/discourse/app/templates/group.gjs b/frontend/discourse/app/templates/group.gjs
index 19250836272..912b7c10ea9 100644
--- a/frontend/discourse/app/templates/group.gjs
+++ b/frontend/discourse/app/templates/group.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AvatarFlair from "discourse/components/avatar-flair";
import DButton from "discourse/components/d-button";
import GroupInfo from "discourse/components/group-info";
@@ -111,7 +111,7 @@ export default <template>
{{#if @controller.model.bio_cooked}}
<div class="group-bio">
- {{htmlSafe @controller.model.bio_cooked}}
+ {{trustHTML @controller.model.bio_cooked}}
</div>
{{/if}}
diff --git a/frontend/discourse/app/templates/invites/show.gjs b/frontend/discourse/app/templates/invites/show.gjs
index 864155297d9..5a733057797 100644
--- a/frontend/discourse/app/templates/invites/show.gjs
+++ b/frontend/discourse/app/templates/invites/show.gjs
@@ -1,6 +1,6 @@
import { Input } from "@ember/component";
import { on } from "@ember/modifier";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import FullnameInput from "discourse/components/fullname-input";
import InputTip from "discourse/components/input-tip";
@@ -43,7 +43,7 @@ export default <template>
<div class="col-form">
{{#if @controller.successMessage}}
<div class="success-info">
- <p>{{htmlSafe @controller.successMessage}}</p>
+ <p>{{trustHTML @controller.successMessage}}</p>
</div>
{{else}}
<div class="invited-by">
@@ -55,13 +55,13 @@ export default <template>
{{#if @controller.associateHtml}}
<p class="create-account-associate-link">
- {{htmlSafe @controller.associateHtml}}
+ {{trustHTML @controller.associateHtml}}
</p>
{{/if}}
{{#unless @controller.isInviteLink}}
<p class="email-message">
- {{htmlSafe @controller.yourEmailMessage}}
+ {{trustHTML @controller.yourEmailMessage}}
{{#if @controller.showSocialLoginAvailable}}
{{i18n "invites.social_login_available"}}
{{/if}}
@@ -257,7 +257,7 @@ export default <template>
</div>
<div class="disclaimer">
- {{htmlSafe @controller.disclaimerHtml}}
+ {{trustHTML @controller.disclaimerHtml}}
</div>
{{#if @controller.errorMessage}}
diff --git a/frontend/discourse/app/templates/login.gjs b/frontend/discourse/app/templates/login.gjs
index e79f79437f2..e3b78793f57 100644
--- a/frontend/discourse/app/templates/login.gjs
+++ b/frontend/discourse/app/templates/login.gjs
@@ -1,5 +1,5 @@
import { hash } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import FlashMessage from "discourse/components/flash-message";
import LocalLoginForm from "discourse/components/local-login-form";
import LoginButtons from "discourse/components/login-buttons";
@@ -41,7 +41,7 @@ export default <template>
<h1 class="login-title">{{i18n "login.no_login_methods.title"}}</h1>
<img />
<p class="login-subheader">
- {{htmlSafe
+ {{trustHTML
(i18n
"login.no_login_methods.description"
diff --git a/frontend/discourse/app/templates/preferences/emails.gjs b/frontend/discourse/app/templates/preferences/emails.gjs
index 7eeda48b56a..68cc71aba36 100644
--- a/frontend/discourse/app/templates/preferences/emails.gjs
+++ b/frontend/discourse/app/templates/preferences/emails.gjs
@@ -1,5 +1,5 @@
import { fn, hash } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import PreferenceCheckbox from "discourse/components/preference-checkbox";
import SaveControls from "discourse/components/save-controls";
@@ -140,7 +140,7 @@ export default <template>
@checked={{@controller.model.user_option.mailing_list_mode}}
/>
<div class="instructions">
- {{htmlSafe (i18n "user.mailing_list_mode.instructions")}}
+ {{trustHTML (i18n "user.mailing_list_mode.instructions")}}
</div>
{{#if @controller.model.user_option.mailing_list_mode}}
<div
diff --git a/frontend/discourse/app/templates/preferences/profile.gjs b/frontend/discourse/app/templates/preferences/profile.gjs
index befb144c757..100f085be59 100644
--- a/frontend/discourse/app/templates/preferences/profile.gjs
+++ b/frontend/discourse/app/templates/preferences/profile.gjs
@@ -1,7 +1,7 @@
import { Input } from "@ember/component";
import { array, fn } from "@ember/helper";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DEditor from "discourse/components/d-editor";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -171,7 +171,7 @@ export default <template>
}}
>
{{replaceEmoji
- (htmlSafe @controller.model.featured_topic.fancy_title)
+ (trustHTML @controller.model.featured_topic.fancy_title)
}}
</LinkTo>
</label>
diff --git a/frontend/discourse/app/templates/preferences/second-factor.gjs b/frontend/discourse/app/templates/preferences/second-factor.gjs
index 51762e7a787..4a64b954794 100644
--- a/frontend/discourse/app/templates/preferences/second-factor.gjs
+++ b/frontend/discourse/app/templates/preferences/second-factor.gjs
@@ -1,5 +1,5 @@
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -119,7 +119,7 @@ export default <template>
{{#if @controller.model.second_factor_enabled}}
<div class="details">
{{#if @controller.model.second_factor_backup_enabled}}
- {{htmlSafe
+ {{trustHTML
(i18n
"user.second_factor_backup.manage"
[email protected]_factor_remaining_backup_codes
diff --git a/frontend/discourse/app/templates/preferences/security.gjs b/frontend/discourse/app/templates/preferences/security.gjs
index 7809b65d4a9..02ac4680339 100644
--- a/frontend/discourse/app/templates/preferences/security.gjs
+++ b/frontend/discourse/app/templates/preferences/security.gjs
@@ -1,6 +1,6 @@
import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AuthTokenDropdown from "discourse/components/auth-token-dropdown";
import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -111,7 +111,7 @@ export default <template>
/>
{{/unless}}
<div class="auth-token-first">
- {{htmlSafe
+ {{trustHTML
(i18n
"user.auth_tokens.device_location"
device=token.device
@@ -122,11 +122,11 @@ export default <template>
</div>
<div class="auth-token-second">
{{#if token.is_active}}
- {{htmlSafe
+ {{trustHTML
(i18n "user.auth_tokens.browser_active" browser=token.browser)
}}
{{else}}
- {{htmlSafe
+ {{trustHTML
(i18n
"user.auth_tokens.browser_last_seen"
browser=token.browser
diff --git a/frontend/discourse/app/templates/privacy.gjs b/frontend/discourse/app/templates/privacy.gjs
index 2b31f58c9cf..4600f8b0d8b 100644
--- a/frontend/discourse/app/templates/privacy.gjs
+++ b/frontend/discourse/app/templates/privacy.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import bodyClass from "discourse/helpers/body-class";
@@ -8,7 +8,7 @@ export default <template>
<section class="container">
<div class="contents clearfix body-page">
<PluginOutlet @name="above-static" />
- {{htmlSafe @controller.model.html}}
+ {{trustHTML @controller.model.html}}
<PluginOutlet @name="below-static" />
</div>
</section>
diff --git a/frontend/discourse/app/templates/review/index.gjs b/frontend/discourse/app/templates/review/index.gjs
index e99f329d996..736c4a6e03f 100644
--- a/frontend/discourse/app/templates/review/index.gjs
+++ b/frontend/discourse/app/templates/review/index.gjs
@@ -1,5 +1,5 @@
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import NavItem from "discourse/components/nav-item";
import ReviewIndex from "discourse/components/reviewable/index";
@@ -42,7 +42,7 @@ import { i18n } from "discourse-i18n";
{{/if}}
{{/each}}
</ul>
- <span class="text">{{htmlSafe
+ <span class="text">{{trustHTML
(i18n
"review.unknown.instruction"
url="https://meta.discourse.org/t/350179"
diff --git a/frontend/discourse/app/templates/signup.gjs b/frontend/discourse/app/templates/signup.gjs
index 3255043b03b..9772d5e8155 100644
--- a/frontend/discourse/app/templates/signup.gjs
+++ b/frontend/discourse/app/templates/signup.gjs
@@ -1,6 +1,6 @@
import { Input } from "@ember/component";
import { on } from "@ember/modifier";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import FlashMessage from "discourse/components/flash-message";
import FullnameInput from "discourse/components/fullname-input";
import HoneypotInput from "discourse/components/honeypot-input";
@@ -65,7 +65,7 @@ export default <template>
<form id="login-form">
{{#if @controller.associateHtml}}
<div class="input-group create-account-associate-link">
- <span>{{htmlSafe @controller.associateHtml}}</span>
+ <span>{{trustHTML @controller.associateHtml}}</span>
</div>
{{/if}}
<div class="input-group create-account-email">
diff --git a/frontend/discourse/app/templates/topic.gjs b/frontend/discourse/app/templates/topic.gjs
index 82c9b1e70e6..c442baa8b80 100644
--- a/frontend/discourse/app/templates/topic.gjs
+++ b/frontend/discourse/app/templates/topic.gjs
@@ -2,7 +2,7 @@ import { array, concat, fn, hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { getProperties } from "@ember/object";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AddCategoryTagClasses from "discourse/components/add-category-tag-classes";
import AddTopicStatusClasses from "discourse/components/add-topic-status-classes";
import AnonymousTopicFooterButtons from "discourse/components/anonymous-topic-footer-buttons";
@@ -174,7 +174,7 @@ export default <template>
{{on "click" @controller.handleTitleClick}}
class="fancy-title"
>
- {{htmlSafe @controller.model.fancyTitle~}}
+ {{trustHTML @controller.model.fancyTitle~}}
{{~#if @controller.model.details.can_edit~}}
<span class="edit-topic__wrapper">
{{icon "pencil" class="edit-topic"}}
@@ -493,7 +493,7 @@ export default <template>
{{#if @controller.model.queued_posts_count}}
<div class="has-pending-posts">
<div>
- {{htmlSafe
+ {{trustHTML
(i18n
"review.topic_has_pending"
[email protected]_posts_count
@@ -631,7 +631,7 @@ export default <template>
<div class="container">
<ConditionalLoadingSpinner @condition={{@controller.noErrorYet}}>
{{#if @controller.model.errorHtml}}
- <div class="not-found">{{htmlSafe
+ <div class="not-found">{{trustHTML
@controller.model.errorHtml
}}</div>
{{else}}
diff --git a/frontend/discourse/app/templates/tos.gjs b/frontend/discourse/app/templates/tos.gjs
index 42cb9e32a7b..a8139e9d8ab 100644
--- a/frontend/discourse/app/templates/tos.gjs
+++ b/frontend/discourse/app/templates/tos.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import bodyClass from "discourse/helpers/body-class";
@@ -8,7 +8,7 @@ export default <template>
<section class="container">
<div class="contents clearfix body-page">
<PluginOutlet @name="above-static" />
- {{htmlSafe @controller.model.html}}
+ {{trustHTML @controller.model.html}}
<PluginOutlet @name="below-static" />
</div>
</section>
diff --git a/frontend/discourse/app/templates/unknown.gjs b/frontend/discourse/app/templates/unknown.gjs
index 22631d0bea0..c037cd0dba0 100644
--- a/frontend/discourse/app/templates/unknown.gjs
+++ b/frontend/discourse/app/templates/unknown.gjs
@@ -1,7 +1,7 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
export default <template>
<div class="container">
- {{htmlSafe @controller.model}}
+ {{trustHTML @controller.model}}
</div>
</template>
diff --git a/frontend/discourse/app/templates/user-invited/show.gjs b/frontend/discourse/app/templates/user-invited/show.gjs
index e4a11d5aaf4..406bcef9b48 100644
--- a/frontend/discourse/app/templates/user-invited/show.gjs
+++ b/frontend/discourse/app/templates/user-invited/show.gjs
@@ -1,6 +1,6 @@
import { fn } from "@ember/helper";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import DropdownMenu from "discourse/components/dropdown-menu";
@@ -178,18 +178,18 @@ export default <template>
<div>
<span
title={{i18n "user.invited.days_visited"}}
- >{{htmlSafe invite.user.days_visited}}</span>
+ >{{trustHTML invite.user.days_visited}}</span>
/
<span
title={{i18n "user.invited.account_age_days"}}
- >{{htmlSafe invite.user.days_since_created}}</span>
+ >{{trustHTML invite.user.days_since_created}}</span>
</div>
</td>
<td class="d-table__cell --detail">
<div class="d-table__mobile-label">
{{i18n "user.invited.invited_via"}}
</div>
- {{htmlSafe invite.invite_source}}
+ {{trustHTML invite.invite_source}}
</td>
{{/if}}
</tr>
diff --git a/frontend/discourse/app/templates/user-private-messages/user.gjs b/frontend/discourse/app/templates/user-private-messages/user.gjs
index 01fe52f1546..f8448d54cb7 100644
--- a/frontend/discourse/app/templates/user-private-messages/user.gjs
+++ b/frontend/discourse/app/templates/user-private-messages/user.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DNavigationItem from "discourse/components/d-navigation-item";
import MessagesSecondaryNav from "discourse/components/user-nav/messages-secondary-nav";
import icon from "discourse/helpers/d-icon";
@@ -6,7 +6,7 @@ import { i18n } from "discourse-i18n";
export default <template>
{{#if @controller.showWarningsWarning}}
- <div class="alert alert-info">{{htmlSafe
+ <div class="alert alert-info">{{trustHTML
(i18n "admin.user.warnings_list_warning")
}}</div>
{{/if}}
diff --git a/frontend/discourse/app/templates/user.gjs b/frontend/discourse/app/templates/user.gjs
index c56316d17a9..e8641d6c66a 100644
--- a/frontend/discourse/app/templates/user.gjs
+++ b/frontend/discourse/app/templates/user.gjs
@@ -1,6 +1,6 @@
import { array, concat, fn, hash } from "@ember/helper";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import HtmlWithLinks from "discourse/components/html-with-links";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -52,7 +52,7 @@ export default <template>
<div class="staff-counters">
{{#if @controller.model.number_of_flags_given}}
<div>
- {{htmlSafe
+ {{trustHTML
(i18n
"user.staff_counters.flags_given"
className="helpful-flags"
@@ -70,7 +70,7 @@ export default <template>
status="all"
}}
>
- {{htmlSafe
+ {{trustHTML
(i18n
"user.staff_counters.flags"
className="flags"
@@ -90,7 +90,7 @@ export default <template>
type="ReviewableQueuedPost"
}}
>
- {{htmlSafe
+ {{trustHTML
(i18n
"user.staff_counters.rejected_posts"
className="flagged-posts"
@@ -107,7 +107,7 @@ export default <template>
@route="user.deletedPosts"
@model={{@controller.model}}
>
- {{htmlSafe
+ {{trustHTML
(i18n
"user.staff_counters.deleted_posts"
className="deleted-posts"
@@ -123,7 +123,7 @@ export default <template>
@route="adminLogs.staffActionLogs"
@query={{@controller.silencingsRouteQuery}}
>
- {{htmlSafe
+ {{trustHTML
(i18n
"user.staff_counters.silencings"
className="silencings"
@@ -139,7 +139,7 @@ export default <template>
@route="adminLogs.staffActionLogs"
@query={{@controller.suspensionsRouteQuery}}
>
- {{htmlSafe
+ {{trustHTML
(i18n
"user.staff_counters.suspensions"
className="suspensions"
@@ -155,7 +155,7 @@ export default <template>
@route="userPrivateMessages.user.warnings"
@model={{@controller.model}}
>
- {{htmlSafe
+ {{trustHTML
(i18n
"user.staff_counters.warnings_received"
className="warnings-received"
@@ -234,7 +234,7 @@ export default <template>
@controller.model.featured_topic.id
}}
>{{replaceEmoji
- (htmlSafe @controller.model.featured_topic.fancy_title)
+ (trustHTML @controller.model.featured_topic.fancy_title)
}}</LinkTo>
</div>
{{/if}}
@@ -309,7 +309,7 @@ export default <template>
{{#if @controller.model.suspend_reason}}
<div class="suspension-reason">
<b>{{i18n "user.suspended_reason"}}</b>
- {{htmlSafe @controller.model.suspend_reason}}
+ {{trustHTML @controller.model.suspend_reason}}
</div>
{{/if}}
</div>
@@ -332,14 +332,14 @@ export default <template>
{{#if @controller.model.silence_reason}}
<div class="silence-reason">
<b>{{i18n "user.silenced_reason"}}</b>
- {{htmlSafe @controller.model.silence_reason}}
+ {{trustHTML @controller.model.silence_reason}}
</div>
{{/if}}
</div>
{{/if}}
{{#if @controller.isNotRestrictedOrIsStaff}}
<HtmlWithLinks>
- {{htmlSafe @controller.model.bio_cooked}}
+ {{trustHTML @controller.model.bio_cooked}}
</HtmlWithLinks>
{{/if}}
</div>
diff --git a/frontend/discourse/app/templates/user/summary.gjs b/frontend/discourse/app/templates/user/summary.gjs
index 54f99f5db2a..f4776198789 100644
--- a/frontend/discourse/app/templates/user/summary.gjs
+++ b/frontend/discourse/app/templates/user/summary.gjs
@@ -1,5 +1,5 @@
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import BadgeCard from "discourse/components/badge-card";
import PluginOutlet from "discourse/components/plugin-outlet";
import UserStat from "discourse/components/user-stat";
@@ -227,7 +227,7 @@ export default <template>
<br />
<a href={{link.post_url}}>
- {{htmlSafe link.topic.fancyTitle}}
+ {{trustHTML link.topic.fancyTitle}}
</a>
</li>
{{/each}}
diff --git a/frontend/discourse/app/templates/users.gjs b/frontend/discourse/app/templates/users.gjs
index 326d7ccf873..36e03cab18b 100644
--- a/frontend/discourse/app/templates/users.gjs
+++ b/frontend/discourse/app/templates/users.gjs
@@ -1,7 +1,7 @@
import { Input } from "@ember/component";
import { fn, hash } from "@ember/helper";
import { on } from "@ember/modifier";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import DirectoryTable from "discourse/components/directory-table";
@@ -113,7 +113,7 @@ export default <template>
(i18n "directory.no_results_with_search")
(if
@controller.currentUser.staff
- (htmlSafe
+ (trustHTML
(i18n
"directory.no_results.extra_body" basePath=(basePath)
)
diff --git a/frontend/discourse/dialog-holder/components/dialog-holder.gjs b/frontend/discourse/dialog-holder/components/dialog-holder.gjs
index a48dce65319..03a1252c1cd 100644
--- a/frontend/discourse/dialog-holder/components/dialog-holder.gjs
+++ b/frontend/discourse/dialog-holder/components/dialog-holder.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import A11yDialog from "a11y-dialog";
import { modifier } from "ember-modifier";
import DButton from "discourse/components/d-button";
@@ -66,7 +66,7 @@ export default class DialogHolder extends Component {
@model={{this.dialog.bodyComponentModel}}
/>
{{else if this.dialog.message}}
- <p>{{htmlSafe this.dialog.message}}</p>
+ <p>{{trustHTML this.dialog.message}}</p>
{{/if}}
</div>
{{/if}}
diff --git a/frontend/discourse/float-kit/components/d-default-toast.gjs b/frontend/discourse/float-kit/components/d-default-toast.gjs
index 259dd35395e..63474a63034 100644
--- a/frontend/discourse/float-kit/components/d-default-toast.gjs
+++ b/frontend/discourse/float-kit/components/d-default-toast.gjs
@@ -1,6 +1,6 @@
import { concat, fn, hash } from "@ember/helper";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
@@ -35,7 +35,7 @@ const DDefaultToast = <template>
{{#if @data.message}}
<div class="fk-d-default-toast__message">
{{#if @data.isHtmlMessage}}
- {{htmlSafe @data.message}}
+ {{trustHTML @data.message}}
{{else}}
{{@data.message}}
{{/if}}
diff --git a/frontend/discourse/float-kit/components/d-float-body.gjs b/frontend/discourse/float-kit/components/d-float-body.gjs
index 4a789b6bcad..471eb04b10f 100644
--- a/frontend/discourse/float-kit/components/d-float-body.gjs
+++ b/frontend/discourse/float-kit/components/d-float-body.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { fn, hash } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier as modifierFn } from "ember-modifier";
import DFloatPortal from "discourse/float-kit/components/d-float-portal";
import { getScrollParent } from "discourse/float-kit/lib/get-scroll-parent";
@@ -68,7 +68,7 @@ export default class DFloatBody extends Component {
? `${this.options.maxWidth}px`
: this.options.maxWidth;
- return htmlSafe(`max-width: ${maxWidth}`);
+ return trustHTML(`max-width: ${maxWidth}`);
}
<template>
diff --git a/frontend/discourse/select-kit/components/category-chooser.js b/frontend/discourse/select-kit/components/category-chooser.js
index 944e76dffe2..fe12051acb5 100644
--- a/frontend/discourse/select-kit/components/category-chooser.js
+++ b/frontend/discourse/select-kit/components/category-chooser.js
@@ -1,5 +1,5 @@
import { computed, set } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isNone } from "@ember/utils";
import { classNames } from "@ember-decorators/component";
import { categoryBadgeHTML } from "discourse/helpers/category-link";
@@ -55,10 +55,12 @@ export default class CategoryChooser extends ComboBoxComponent {
const isString = typeof none === "string";
return this.defaultItem(
null,
- htmlSafe(i18n(isString ? this.selectKit.options.none : "category.none"))
+ trustHTML(
+ i18n(isString ? this.selectKit.options.none : "category.none")
+ )
);
} else if (this.selectKit.options.readOnlyCategoryId) {
- return this.defaultItem(null, htmlSafe(i18n("category.choose")));
+ return this.defaultItem(null, trustHTML(i18n("category.choose")));
} else if (this.selectKit.options.allowUncategorized) {
return Category.findUncategorized();
} else {
@@ -67,7 +69,7 @@ export default class CategoryChooser extends ComboBoxComponent {
10
);
if (!defaultCategoryId || defaultCategoryId < 0) {
- return this.defaultItem(null, htmlSafe(i18n("category.choose")));
+ return this.defaultItem(null, trustHTML(i18n("category.choose")));
}
}
}
@@ -79,7 +81,7 @@ export default class CategoryChooser extends ComboBoxComponent {
set(
content,
"label",
- htmlSafe(
+ trustHTML(
categoryBadgeHTML(category, {
link: false,
hideParent: category ? !!category.parent_category_id : true,
diff --git a/frontend/discourse/select-kit/components/category-drop.js b/frontend/discourse/select-kit/components/category-drop.js
index de9bb55c2cc..c3450117c76 100644
--- a/frontend/discourse/select-kit/components/category-drop.js
+++ b/frontend/discourse/select-kit/components/category-drop.js
@@ -1,6 +1,6 @@
import { action, computed } from "@ember/object";
import { readOnly } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNameBindings, classNames } from "@ember-decorators/component";
import { categoryBadgeHTML } from "discourse/helpers/category-link";
import { setting } from "discourse/lib/computed";
@@ -156,7 +156,7 @@ export default class CategoryDrop extends ComboBoxComponent {
if (this.value) {
const category = Category.findById(this.value);
content.title = category.title;
- content.label = htmlSafe(
+ content.label = trustHTML(
categoryBadgeHTML(category, {
link: false,
allowUncategorized: true,
diff --git a/frontend/discourse/select-kit/components/category-row.gjs b/frontend/discourse/select-kit/components/category-row.gjs
index 63047757231..c53899896e4 100644
--- a/frontend/discourse/select-kit/components/category-row.gjs
+++ b/frontend/discourse/select-kit/components/category-row.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { guidFor } from "@ember/object/internals";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty, isNone } from "@ember/utils";
import { categoryBadgeHTML } from "discourse/helpers/category-link";
import concatClass from "discourse/helpers/concat-class";
@@ -119,7 +119,7 @@ export default class CategoryRow extends Component {
@cached
get badgeForCategory() {
- return htmlSafe(
+ return trustHTML(
categoryBadgeHTML(this.category, {
link: false,
allowUncategorized:
@@ -311,7 +311,7 @@ export default class CategoryRow extends Component {
</div>
{{/if}}
{{else}}
- {{htmlSafe this.label}}
+ {{trustHTML this.label}}
{{/if}}
</div>
</template>
diff --git a/frontend/discourse/select-kit/components/color-palettes/color-palettes-row.gjs b/frontend/discourse/select-kit/components/color-palettes/color-palettes-row.gjs
index ee54b1bec20..1db9f0da7d5 100644
--- a/frontend/discourse/select-kit/components/color-palettes/color-palettes-row.gjs
+++ b/frontend/discourse/select-kit/components/color-palettes/color-palettes-row.gjs
@@ -1,5 +1,5 @@
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNames } from "@ember-decorators/component";
import SelectKitRowComponent from "discourse/select-kit/components/select-kit/select-kit-row";
@@ -7,7 +7,7 @@ import SelectKitRowComponent from "discourse/select-kit/components/select-kit/se
export default class ColorPalettesRow extends SelectKitRowComponent {
@computed("item.colors.[]")
get palettes() {
- return htmlSafe(
+ return trustHTML(
(this.item.colors || [])
.filter((color) => color.name !== "secondary")
.map((color) => `#${escape(color.hex)}`)
@@ -26,7 +26,7 @@ export default class ColorPalettesRow extends SelectKitRowComponent {
);
if (secondary && secondary.hex) {
- return htmlSafe(`background-color:#${escape(secondary.hex)}`);
+ return trustHTML(`background-color:#${escape(secondary.hex)}`);
} else {
return "";
}
diff --git a/frontend/discourse/select-kit/components/dropdown-select-box/dropdown-select-box-row.gjs b/frontend/discourse/select-kit/components/dropdown-select-box/dropdown-select-box-row.gjs
index bdd6aa6c71b..a097ba997d1 100644
--- a/frontend/discourse/select-kit/components/dropdown-select-box/dropdown-select-box-row.gjs
+++ b/frontend/discourse/select-kit/components/dropdown-select-box/dropdown-select-box-row.gjs
@@ -1,5 +1,5 @@
import { readOnly } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNames } from "@ember-decorators/component";
import icon from "discourse/helpers/d-icon";
import SelectKitRowComponent from "discourse/select-kit/components/select-kit/select-kit-row";
@@ -19,9 +19,9 @@ export default class DropdownSelectBoxRow extends SelectKitRowComponent {
{{/if}}
<div class="texts">
- <span class="name">{{htmlSafe this.label}}</span>
+ <span class="name">{{trustHTML this.label}}</span>
{{#if this.description}}
- <span class="desc">{{htmlSafe this.description}}</span>
+ <span class="desc">{{trustHTML this.description}}</span>
{{/if}}
</div>
</template>
diff --git a/frontend/discourse/select-kit/components/homepage-style-selector/homepage-style-selector-row.gjs b/frontend/discourse/select-kit/components/homepage-style-selector/homepage-style-selector-row.gjs
index 8cede99f4d0..aeac1d3f075 100644
--- a/frontend/discourse/select-kit/components/homepage-style-selector/homepage-style-selector-row.gjs
+++ b/frontend/discourse/select-kit/components/homepage-style-selector/homepage-style-selector-row.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNames } from "@ember-decorators/component";
import SelectKitRowComponent from "discourse/select-kit/components/select-kit/select-kit-row";
@@ -6,9 +6,9 @@ import SelectKitRowComponent from "discourse/select-kit/components/select-kit/se
export default class HomepageStyleSelectorRow extends SelectKitRowComponent {
<template>
<div class="texts">
- <span class="name">{{htmlSafe this.label}}</span>
+ <span class="name">{{trustHTML this.label}}</span>
{{#if this.item.description}}
- <span class="desc">{{htmlSafe this.item.description}}</span>
+ <span class="desc">{{trustHTML this.item.description}}</span>
{{/if}}
</div>
</template>
diff --git a/frontend/discourse/select-kit/components/multi-select/selected-category.gjs b/frontend/discourse/select-kit/components/multi-select/selected-category.gjs
index afd2a95fe2f..ecea45226cd 100644
--- a/frontend/discourse/select-kit/components/multi-select/selected-category.gjs
+++ b/frontend/discourse/select-kit/components/multi-select/selected-category.gjs
@@ -1,6 +1,6 @@
import { on } from "@ember/modifier";
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNames } from "@ember-decorators/component";
import { categoryBadgeHTML } from "discourse/helpers/category-link";
import icon from "discourse/helpers/d-icon";
@@ -10,7 +10,7 @@ import SelectedNameComponent from "discourse/select-kit/components/selected-name
export default class SelectedCategory extends SelectedNameComponent {
@computed("item")
get badge() {
- return htmlSafe(
+ return trustHTML(
categoryBadgeHTML(this.item, {
allowUncategorized: true,
link: false,
diff --git a/frontend/discourse/select-kit/components/multi-select/selected-color.js b/frontend/discourse/select-kit/components/multi-select/selected-color.js
index 4b8803e4061..e0227dae76c 100644
--- a/frontend/discourse/select-kit/components/multi-select/selected-color.js
+++ b/frontend/discourse/select-kit/components/multi-select/selected-color.js
@@ -1,5 +1,5 @@
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNames } from "@ember-decorators/component";
import SelectedNameComponent from "discourse/select-kit/components/selected-name";
@@ -7,7 +7,7 @@ import SelectedNameComponent from "discourse/select-kit/components/selected-name
export default class SelectedColor extends SelectedNameComponent {
@computed("name")
get footerContent() {
- return htmlSafe(
+ return trustHTML(
`<span class="color-preview" style="background:#${this.name}"></span>`
);
}
diff --git a/frontend/discourse/select-kit/components/none-category-row.gjs b/frontend/discourse/select-kit/components/none-category-row.gjs
index d4b5d657cb4..4a0052a9d6a 100644
--- a/frontend/discourse/select-kit/components/none-category-row.gjs
+++ b/frontend/discourse/select-kit/components/none-category-row.gjs
@@ -1,5 +1,5 @@
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNames } from "@ember-decorators/component";
import { categoryBadgeHTML } from "discourse/helpers/category-link";
import dirSpan from "discourse/helpers/dir-span";
@@ -9,7 +9,7 @@ import CategoryRowComponent from "discourse/select-kit/components/category-row";
export default class NoneCategoryRow extends CategoryRowComponent {
@computed("category")
get badgeForCategory() {
- return htmlSafe(
+ return trustHTML(
categoryBadgeHTML(this.category, {
link: false,
allowUncategorized: true,
@@ -32,7 +32,7 @@ export default class NoneCategoryRow extends CategoryRowComponent {
}}</div>
{{/if}}
{{else}}
- {{htmlSafe this.label}}
+ {{trustHTML this.label}}
{{/if}}
</template>
}
diff --git a/frontend/discourse/select-kit/components/selected-choice-category.gjs b/frontend/discourse/select-kit/components/selected-choice-category.gjs
index b5f9e8b7d46..a1c7560b68f 100644
--- a/frontend/discourse/select-kit/components/selected-choice-category.gjs
+++ b/frontend/discourse/select-kit/components/selected-choice-category.gjs
@@ -1,5 +1,5 @@
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { categoryBadgeHTML } from "discourse/helpers/category-link";
import SelectedChoiceComponent from "discourse/select-kit/components/selected-choice";
@@ -10,7 +10,7 @@ export default class SelectedChoiceCategory extends SelectedChoiceComponent {
@computed("item")
get badge() {
- return htmlSafe(
+ return trustHTML(
categoryBadgeHTML(this.item, {
allowUncategorized: true,
link: false,
diff --git a/frontend/discourse/select-kit/components/topic-notifications-button.gjs b/frontend/discourse/select-kit/components/topic-notifications-button.gjs
index 2c80522ad93..55bf5a82f0c 100644
--- a/frontend/discourse/select-kit/components/topic-notifications-button.gjs
+++ b/frontend/discourse/select-kit/components/topic-notifications-button.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import TopicNotificationsTracking from "discourse/components/topic-notifications-tracking";
import getURL from "discourse/lib/get-url";
@@ -129,7 +129,7 @@ export default class TopicNotificationsButton extends Component {
/>
{{#if @expanded}}
- <span class="text">{{htmlSafe this.reasonText}}</span>
+ <span class="text">{{trustHTML this.reasonText}}</span>
{{/if}}
</this.conditionalWrapper>
</div>
diff --git a/frontend/discourse/tests/integration/components/decorated-html-test.gjs b/frontend/discourse/tests/integration/components/decorated-html-test.gjs
index 63b9cde6b31..83533a79caa 100644
--- a/frontend/discourse/tests/integration/components/decorated-html-test.gjs
+++ b/frontend/discourse/tests/integration/components/decorated-html-test.gjs
@@ -1,6 +1,6 @@
import { tracked } from "@glimmer/tracking";
import { getOwner } from "@ember/owner";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { render, settled } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import curryComponent from "ember-curry-component";
@@ -17,14 +17,14 @@ module("Integration | Component | <DecoratedHtml />", function (hooks) {
test("renders and re-renders content", async function (assert) {
const state = new (class {
- @tracked html = htmlSafe("<h1>Initial</h1>");
+ @tracked html = trustHTML("<h1>Initial</h1>");
})();
await render(<template><DecoratedHtml @html={{state.html}} /></template>);
assert.dom("h1").hasText("Initial");
- state.html = htmlSafe("<h1>Updated</h1>");
+ state.html = trustHTML("<h1>Updated</h1>");
await settled();
assert.dom("h1").hasText("Updated");
@@ -32,7 +32,7 @@ module("Integration | Component | <DecoratedHtml />", function (hooks) {
test("can decorate content, including renderGlimmer", async function (assert) {
const state = new (class {
- @tracked html = htmlSafe("<h1>Initial</h1>");
+ @tracked html = trustHTML("<h1>Initial</h1>");
})();
const decorate = (element, helper) => {
@@ -58,7 +58,7 @@ module("Integration | Component | <DecoratedHtml />", function (hooks) {
test("can decorate content with renderGlimmer using a curried component", async function (assert) {
const state = new (class {
- @tracked html = htmlSafe("<h1>Initial</h1>");
+ @tracked html = trustHTML("<h1>Initial</h1>");
})();
const decorate = (element, helper) => {
@@ -88,7 +88,7 @@ module("Integration | Component | <DecoratedHtml />", function (hooks) {
test("renderGlimmer is ignored if receives invalid arguments", async function (assert) {
const state = new (class {
- @tracked html = htmlSafe("<h1>Initial</h1>");
+ @tracked html = trustHTML("<h1>Initial</h1>");
})();
const decorateWithStringTarget = (element, helper) => {
@@ -179,7 +179,7 @@ module("Integration | Component | <DecoratedHtml />", function (hooks) {
await render(
<template>
- <DecoratedHtml @html={{htmlSafe "<div>Content</div>"}} />
+ <DecoratedHtml @html={{trustHTML "<div>Content</div>"}} />
</template>
);
@@ -202,7 +202,7 @@ module("Integration | Component | <DecoratedHtml />", function (hooks) {
await render(
<template>
<DecoratedHtml
- @html={{htmlSafe "<div>Content</div>"}}
+ @html={{trustHTML "<div>Content</div>"}}
@decorate={{customDecorator}}
/>
</template>
diff --git a/frontend/discourse/tests/integration/components/form-kit/field-test.gjs b/frontend/discourse/tests/integration/components/form-kit/field-test.gjs
index 0d4213bc7de..d313432530f 100644
--- a/frontend/discourse/tests/integration/components/form-kit/field-test.gjs
+++ b/frontend/discourse/tests/integration/components/form-kit/field-test.gjs
@@ -1,5 +1,5 @@
import { fn, hash } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import {
click,
fillIn,
@@ -128,7 +128,7 @@ module("Integration | Component | FormKit | Field", function (hooks) {
});
test("@title with htmlSafe", async function (assert) {
- const htmlTitle = htmlSafe('Title with <a href="#">link</a>');
+ const htmlTitle = trustHTML('Title with <a href="#">link</a>');
await render(
<template>
diff --git a/frontend/discourse/tests/integration/helpers/html-safe-test.gjs b/frontend/discourse/tests/integration/helpers/html-safe-test.gjs
index a34988fac56..75d504c54ea 100644
--- a/frontend/discourse/tests/integration/helpers/html-safe-test.gjs
+++ b/frontend/discourse/tests/integration/helpers/html-safe-test.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { render } from "@ember/test-helpers";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
@@ -9,7 +9,7 @@ module("Integration | Helper | html-safe", function (hooks) {
test("default", async function (assert) {
const string = "<p class='cookies'>biscuits</p>";
- await render(<template>{{htmlSafe string}}</template>);
+ await render(<template>{{trustHTML string}}</template>);
assert.dom("p.cookies").exists("displays the string as html");
});
diff --git a/frontend/discourse/tests/integration/helpers/replace-emoji-test.gjs b/frontend/discourse/tests/integration/helpers/replace-emoji-test.gjs
index b9a74c088c1..9f3ad8f566c 100644
--- a/frontend/discourse/tests/integration/helpers/replace-emoji-test.gjs
+++ b/frontend/discourse/tests/integration/helpers/replace-emoji-test.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { render } from "@ember/test-helpers";
import { module, test } from "qunit";
import replaceEmoji from "discourse/helpers/replace-emoji";
@@ -31,7 +31,7 @@ module("Integration | Helper | replace-emoji", function (hooks) {
test("it renders html-safe text", async function (assert) {
await render(
<template>
- <span>{{replaceEmoji (htmlSafe "safe text")}}</span>
+ <span>{{replaceEmoji (trustHTML "safe text")}}</span>
</template>
);
diff --git a/frontend/discourse/tests/unit/lib/computed-test.js b/frontend/discourse/tests/unit/lib/computed-test.js
index 565a23ec4fd..b93e327b4d9 100644
--- a/frontend/discourse/tests/unit/lib/computed-test.js
+++ b/frontend/discourse/tests/unit/lib/computed-test.js
@@ -5,10 +5,10 @@ import { module, test } from "qunit";
import {
computedI18n,
fmt,
- htmlSafe,
propertyEqual,
propertyNotEqual,
setting,
+ trustHTML,
url,
} from "discourse/lib/computed";
import { setPrefix } from "discourse/lib/get-url";
@@ -161,11 +161,11 @@ module("Unit | Utility | computed", function (hooks) {
);
});
- test("htmlSafe", function (assert) {
+ test("trustHTML", function (assert) {
const cookies = "<p>cookies and <b>biscuits</b></p>";
// eslint-disable-next-line ember/no-classic-classes
const t = EmberObject.extend({
- desc: htmlSafe("cookies"),
+ desc: trustHTML("cookies"),
}).create({ cookies });
assert.strictEqual(t.desc.toString(), cookies);
diff --git a/frontend/discourse/tests/unit/lib/notification-types/bookmark-reminder-test.js b/frontend/discourse/tests/unit/lib/notification-types/bookmark-reminder-test.js
index fd928806b7a..5f7ae5087ea 100644
--- a/frontend/discourse/tests/unit/lib/notification-types/bookmark-reminder-test.js
+++ b/frontend/discourse/tests/unit/lib/notification-types/bookmark-reminder-test.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { setupTest } from "ember-qunit";
import { module, test } from "qunit";
import { deepMerge } from "discourse/lib/object";
@@ -73,7 +73,7 @@ module("Unit | Notification Types | bookmark-reminder", function (hooks) {
);
assert.deepEqual(
director.description,
- htmlSafe("my fancy title!"),
+ trustHTML("my fancy title!"),
"description is the fancy title by default"
);
diff --git a/frontend/discourse/tests/unit/lib/reviewable-types/flagged-post-test.js b/frontend/discourse/tests/unit/lib/reviewable-types/flagged-post-test.js
index d9e6f4d270c..aa9f178b31d 100644
--- a/frontend/discourse/tests/unit/lib/reviewable-types/flagged-post-test.js
+++ b/frontend/discourse/tests/unit/lib/reviewable-types/flagged-post-test.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { setupTest } from "ember-qunit";
import { module, test } from "qunit";
import { emojiUnescape } from "discourse/lib/text";
@@ -36,7 +36,7 @@ module("Unit | Reviewable Items | flagged-post", function (hooks) {
);
assert.deepEqual(
director.description,
- htmlSafe(
+ trustHTML(
i18n("user_menu.reviewable.post_number_with_topic_title", {
title: `This is safe title &lt;a&gt; ${emojiUnescape(":heart:")}`,
post_number: 1,
diff --git a/frontend/discourse/tests/unit/lib/reviewable-types/queued-post-test.js b/frontend/discourse/tests/unit/lib/reviewable-types/queued-post-test.js
index f1504d70c55..4f40f080444 100644
--- a/frontend/discourse/tests/unit/lib/reviewable-types/queued-post-test.js
+++ b/frontend/discourse/tests/unit/lib/reviewable-types/queued-post-test.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { setupTest } from "ember-qunit";
import { module, test } from "qunit";
import { emojiUnescape } from "discourse/lib/text";
@@ -35,7 +35,7 @@ module("Unit | Reviewable Items | queued-post", function (hooks) {
);
assert.deepEqual(
director.description,
- htmlSafe(
+ trustHTML(
i18n("user_menu.reviewable.new_post_in_topic", {
title: `This is safe title &lt;a&gt; ${emojiUnescape(":heart:")}`,
})
@@ -47,7 +47,7 @@ module("Unit | Reviewable Items | queued-post", function (hooks) {
reviewable.payload_title = "This is unsafe title <a> :heart:";
assert.deepEqual(
director.description,
- htmlSafe(
+ trustHTML(
i18n("user_menu.reviewable.new_post_in_topic", {
title: `This is unsafe title &lt;a&gt; ${emojiUnescape(":heart:")}`,
})
diff --git a/plugins/automation/admin/assets/javascripts/admin/components/form-error.gjs b/plugins/automation/admin/assets/javascripts/admin/components/form-error.gjs
index ea913118a9b..f25c70eed44 100644
--- a/plugins/automation/admin/assets/javascripts/admin/components/form-error.gjs
+++ b/plugins/automation/admin/assets/javascripts/admin/components/form-error.gjs
@@ -1,9 +1,9 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
const FormError = <template>
{{#if @error}}
<div class="alert alert-error form-errors">
- {{htmlSafe @error}}
+ {{trustHTML @error}}
</div>
{{/if}}
</template>;
diff --git a/plugins/chat/assets/javascripts/discourse/components/channel-icon/index.gjs b/plugins/chat/assets/javascripts/discourse/components/channel-icon/index.gjs
index 8030169cdcb..e5da8a175b9 100644
--- a/plugins/chat/assets/javascripts/discourse/components/channel-icon/index.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/channel-icon/index.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
import replaceEmoji from "discourse/helpers/replace-emoji";
@@ -18,7 +18,7 @@ export default class ChatChannelIcon extends Component {
}
get channelColorStyle() {
- return htmlSafe(`color: #${this.args.channel.chatable.color}`);
+ return trustHTML(`color: #${this.args.channel.chatable.color}`);
}
get isThreadsList() {
diff --git a/plugins/chat/assets/javascripts/discourse/components/channel-name/index.gjs b/plugins/chat/assets/javascripts/discourse/components/channel-name/index.gjs
index 85eb8eb1dd5..40ef663ee5a 100644
--- a/plugins/chat/assets/javascripts/discourse/components/channel-name/index.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/channel-name/index.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { get } from "@ember/helper";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import UserStatusMessage from "discourse/components/user-status-message";
import lazyHash from "discourse/helpers/lazy-hash";
@@ -40,7 +40,7 @@ export default class ChatChannelName extends Component {
}
get channelColorStyle() {
- return htmlSafe(`color: #${this.args.channel.chatable.color}`);
+ return trustHTML(`color: #${this.args.channel.chatable.color}`);
}
get showUserStatus() {
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-archive-status.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-archive-status.gjs
index 8b8475912bd..ee61cef66db 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-archive-status.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-archive-status.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isPresent } from "@ember/utils";
import DButton from "discourse/components/d-button";
import concatClass from "discourse/helpers/concat-class";
@@ -22,7 +22,7 @@ export default class ChatChannelArchiveStatus extends Component {
const translationKey = !archive.topicId
? "chat.channel_status.archive_failed_no_topic"
: "chat.channel_status.archive_failed";
- return htmlSafe(
+ return trustHTML(
i18n(translationKey, {
completed: archive.messages,
total: archive.totalMessages,
@@ -32,7 +32,7 @@ export default class ChatChannelArchiveStatus extends Component {
}
get channelArchiveCompletedMessage() {
- return htmlSafe(
+ return trustHTML(
i18n("chat.channel_status.archive_completed", {
topic_url: this.topicUrl,
})
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs
index ddaaa77e55a..c48d0298f09 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs
@@ -1,6 +1,6 @@
import { concat, hash } from "@ember/helper";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
import replaceEmoji from "discourse/helpers/replace-emoji";
@@ -16,7 +16,7 @@ import ToggleChannelMembershipButton from "./toggle-channel-membership-button";
(if @channel.isClosed "--closed")
(if @channel.isArchived "--archived")
}}
- style={{htmlSafe
+ style={{trustHTML
(concat "--chat-channel-card-border: #" @channel.chatable.color)
}}
data-channel-id={{@channel.id}}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.gjs
index 8ca9953e6ea..1a2661a91d7 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.gjs
@@ -6,7 +6,7 @@ import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier as modifierFn } from "ember-modifier";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
@@ -41,7 +41,7 @@ export default class ChatChannelRow extends Component {
onReset = modifierFn((element) => {
const handler = () => {
- this.rowStyle = htmlSafe("margin-right: 0px;");
+ this.rowStyle = trustHTML("margin-right: 0px;");
this.showRemoveButton = false;
this.shouldReset = false;
};
@@ -50,7 +50,7 @@ export default class ChatChannelRow extends Component {
return () => {
element.removeEventListener("transitionend", handler);
- this.rowStyle = htmlSafe("margin-right: 0px;");
+ this.rowStyle = trustHTML("margin-right: 0px;");
this.showRemoveButton = false;
this.shouldReset = false;
};
@@ -107,16 +107,16 @@ export default class ChatChannelRow extends Component {
this.diff = threshold + (this.diff - threshold) * 0.1;
}
- this.rowStyle = htmlSafe(`margin-right: ${this.diff}px;`);
+ this.rowStyle = trustHTML(`margin-right: ${this.diff}px;`);
} else {
- this.rowStyle = htmlSafe("margin-right: 0px;");
+ this.rowStyle = trustHTML("margin-right: 0px;");
}
}
@bind
onSwipeEnd() {
if (this.isAtThreshold) {
- this.rowStyle = htmlSafe("margin-right: 0px;");
+ this.rowStyle = trustHTML("margin-right: 0px;");
this.shouldRemoveChannel = true;
} else {
this.shouldReset = true;
@@ -201,7 +201,7 @@ export default class ChatChannelRow extends Component {
<ChatChannelMetadata @channel={{@channel}} />
{{#if this.shouldRenderLastMessage}}
<div class="chat-channel__last-message">
- {{replaceEmoji (htmlSafe @channel.lastMessage.excerpt)}}
+ {{replaceEmoji (trustHTML @channel.lastMessage.excerpt)}}
</div>
{{/if}}
</div>
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.gjs
index b52687b499a..d69639bc2bf 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import icon from "discourse/helpers/d-icon";
import replaceEmoji from "discourse/helpers/replace-emoji";
@@ -15,7 +15,7 @@ const ChatComposerMessageDetails = <template>
<ChatUserAvatar @user={{@message.user}} />
<span class="chat-reply__username">{{@message.user.username}}</span>
<span class="chat-reply__excerpt">
- {{replaceEmoji (htmlSafe @message.excerpt)}}
+ {{replaceEmoji (trustHTML @message.excerpt)}}
</span>
</div>
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjs
index fa415b0cae9..960503de6bf 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjs
@@ -3,7 +3,7 @@ import Component from "@ember/component";
import { action } from "@ember/object";
import { cancel, next, throttle } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { observes } from "@ember-decorators/object";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -101,7 +101,7 @@ export default class ChatDrawer extends Component {
const { width, height } = this.chatDrawerSize.size;
let style = `width: ${escapeExpression((width || "0").toString())}px;`;
style += `height: ${escapeExpression((height || "0").toString())}px;`;
- this.set("drawerStyle", htmlSafe(style));
+ this.set("drawerStyle", trustHTML(style));
}
get drawerActions() {
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-mention-warnings.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-mention-warnings.gjs
index 517e3f1e35c..6cfe8d7f0c5 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-mention-warnings.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-mention-warnings.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
import getURL from "discourse/lib/get-url";
import I18n, { i18n } from "discourse-i18n";
@@ -87,7 +87,7 @@ export default class ChatMentionWarnings extends Component {
}
if (this.currentUser.admin) {
- return htmlSafe(
+ return trustHTML(
i18n("chat.mention_warning.too_many_mentions_admin", {
count: this.siteSettings.max_mentions_per_chat_message,
siteSettingUrl: getURL(
@@ -96,7 +96,7 @@ export default class ChatMentionWarnings extends Component {
})
);
} else {
- return htmlSafe(
+ return trustHTML(
i18n("chat.mention_warning.too_many_mentions", {
count: this.siteSettings.max_mentions_per_chat_message,
})
@@ -132,7 +132,7 @@ export default class ChatMentionWarnings extends Component {
return;
}
- return htmlSafe(
+ return trustHTML(
I18n.messageFormat("chat.mention_warning.groups.too_many_members_MF", {
groupCount: this.overMembersLimitMentionsCount,
isAdmin: this.currentUser.admin,
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-collapser.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-message-collapser.gjs
index dc62ab39300..98d95fce2a8 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-collapser.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-collapser.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { schedule } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import DecoratedHtml from "discourse/components/decorated-html";
import domFromString from "discourse/lib/dom-from-string";
@@ -46,7 +46,7 @@ export default class ChatMessageCollapser extends Component {
} else {
name = i18n("chat.uploaded_files", { count: this.args.uploads.length });
}
- return htmlSafe(
+ return trustHTML(
`<span class="chat-message-collapser-link-small">${escapeExpression(
name
)}</span>`
@@ -104,7 +104,7 @@ export default class ChatMessageCollapser extends Component {
if (this.siteSettings[`lazy_${videoAttributes.providerName}_enabled`]) {
const link = escapeExpression(videoAttributes.url);
const title = videoAttributes.title;
- const header = htmlSafe(
+ const header = trustHTML(
`<a target="_blank" class="chat-message-collapser-link" rel="noopener noreferrer" href="${link}">${title}</a>`
);
@@ -132,7 +132,7 @@ export default class ChatMessageCollapser extends Component {
: e.firstElementChild.href;
link = escapeExpression(link);
- const header = htmlSafe(
+ const header = trustHTML(
`<a target="_blank" class="chat-message-collapser-link-small" rel="noopener noreferrer" href="${link}">${link}</a>`
);
acc.push({ header, body: e.outerHTML, needsCollapser: true });
@@ -148,7 +148,7 @@ export default class ChatMessageCollapser extends Component {
if (imagePredicate(e)) {
const link = escapeExpression(e.firstElementChild.src);
const alt = escapeExpression(e.firstElementChild.alt);
- const header = htmlSafe(
+ const header = trustHTML(
`<a target="_blank" class="chat-message-collapser-link-small" rel="noopener noreferrer" href="${link}">${
alt || link
}</a>`
@@ -169,7 +169,7 @@ export default class ChatMessageCollapser extends Component {
e.firstElementChild.firstElementChild.textContent
);
e.firstElementChild.removeChild(e.firstElementChild.firstElementChild);
- const header = htmlSafe(
+ const header = trustHTML(
`<a target="_blank" class="chat-message-collapser-link-small" rel="noopener noreferrer" href="${link}">${title}</a>`
);
acc.push({ header, body: e.outerHTML, needsCollapser: true });
@@ -184,7 +184,7 @@ export default class ChatMessageCollapser extends Component {
<div class="chat-message-collapser">
{{#if this.hasUploads}}
<DecoratedHtml
- @html={{htmlSafe @cooked}}
+ @html={{trustHTML @cooked}}
@decorate={{@decorate}}
@className="chat-cooked"
/>
@@ -216,7 +216,7 @@ export default class ChatMessageCollapser extends Component {
</div>
{{else}}
<DecoratedHtml
- @html={{htmlSafe cooked.body}}
+ @html={{trustHTML cooked.body}}
@decorate={{@decorate}}
@className="chat-cooked"
/>
@@ -224,7 +224,7 @@ export default class ChatMessageCollapser extends Component {
</Collapser>
{{else}}
<DecoratedHtml
- @html={{htmlSafe cooked.body}}
+ @html={{trustHTML cooked.body}}
@decorate={{@decorate}}
@className="chat-cooked"
/>
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-in-reply-to-indicator.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-message-in-reply-to-indicator.gjs
index dd3e663e6e5..84e2798dac9 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-in-reply-to-indicator.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-in-reply-to-indicator.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
import replaceEmoji from "discourse/helpers/replace-emoji";
import ChatEmojiAvatar from "./chat-emoji-avatar";
@@ -54,7 +54,7 @@ export default class ChatMessageInReplyToIndicator extends Component {
{{/if}}
<span class="chat-reply__excerpt">
- {{replaceEmoji (htmlSafe @message.inReplyTo.excerpt)}}
+ {{replaceEmoji (trustHTML @message.inReplyTo.excerpt)}}
</span>
</LinkTo>
{{/if}}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.gjs
index 25ae64e18e6..77f1f5d97e8 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.gjs
@@ -3,7 +3,7 @@ import { cached } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import concatClass from "discourse/helpers/concat-class";
import { emojiUnescape, emojiUrlFor } from "discourse/lib/text";
@@ -21,7 +21,7 @@ export default class ChatMessageReaction extends Component {
}
const instance = this.tooltip.register(element, {
- content: htmlSafe(this.popoverContent),
+ content: trustHTML(this.popoverContent),
identifier: "chat-message-reaction-tooltip",
animated: false,
placement: "top",
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-text.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-message-text.gjs
index cb6e2a1761a..3f0704b3a5b 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-text.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-text.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DecoratedHtml from "discourse/components/decorated-html";
import { i18n } from "discourse-i18n";
import { isCollapsible } from "discourse/plugins/chat/discourse/components/chat-message-collapser";
@@ -25,7 +25,7 @@ export default class ChatMessageText extends Component {
/>
{{else}}
<DecoratedHtml
- @html={{htmlSafe @cooked}}
+ @html={{trustHTML @cooked}}
@decorate={{@decorate}}
@className="chat-cooked"
/>
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-thread-indicator.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-message-thread-indicator.gjs
index 29141716084..f7aedd80d39 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-thread-indicator.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-thread-indicator.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import formatDate from "discourse/helpers/format-date";
import replaceEmoji from "discourse/helpers/replace-emoji";
import { i18n } from "discourse-i18n";
@@ -52,7 +52,7 @@ export default class ChatMessageThreadIndicator extends Component {
</div>
<ChatThreadParticipants @thread={{@message.thread}} />
<div class="chat-message-thread-indicator__last-reply-excerpt">
- {{replaceEmoji (htmlSafe @message.thread.preview.lastReplyExcerpt)}}
+ {{replaceEmoji (trustHTML @message.thread.preview.lastReplyExcerpt)}}
</div>
</LinkTo>
</template>
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message/blocks/elements/category.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-message/blocks/elements/category.gjs
index bb29eb83d69..d8e4f4db768 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message/blocks/elements/category.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message/blocks/elements/category.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
export default class CategoryElement extends Component {
get boxStyle() {
@@ -7,12 +7,12 @@ export default class CategoryElement extends Component {
if (this.args.definition.parent_color) {
style += `; --parent-category-badge-color: #${this.args.definition.parent_color}`;
}
- return htmlSafe(style);
+ return trustHTML(style);
}
get parentBadgeStyle() {
return this.args.definition.parent_color
- ? htmlSafe(
+ ? trustHTML(
`--category-badge-color: #${this.args.definition.parent_color}`
)
: null;
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-retention-reminder-text.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-retention-reminder-text.gjs
index ffb332218e1..f44afdb3560 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-retention-reminder-text.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-retention-reminder-text.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import getURL from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
@@ -26,11 +26,11 @@ export default class ChatRetentionReminderText extends Component {
const count = this.#countForChannelType;
if (count > 0) {
- return htmlSafe(
+ return trustHTML(
i18n(`chat.retention_reminders.${this.type}`, { ...opts, count })
);
} else {
- return htmlSafe(
+ return trustHTML(
i18n(`chat.retention_reminders.indefinitely_${this.type}`, opts)
);
}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-skeleton.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-skeleton.gjs
index 3f9080b6903..7fa3f6ccf73 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-skeleton.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-skeleton.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
export default class ChatSkeleton extends Component {
get placeholders() {
@@ -7,7 +7,7 @@ export default class ChatSkeleton extends Component {
return {
image: this.#randomIntFromInterval(1, 10) === 5,
rows: Array.from({ length: this.#randomIntFromInterval(1, 5) }, () => {
- return htmlSafe(`width: ${this.#randomIntFromInterval(20, 95)}%`);
+ return trustHTML(`width: ${this.#randomIntFromInterval(20, 95)}%`);
}),
reactions: Array.from({ length: this.#randomIntFromInterval(0, 3) }),
};
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-to-topic-selector.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-to-topic-selector.gjs
index 04a7f1fa4db..9ce70d81a7c 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-to-topic-selector.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-to-topic-selector.gjs
@@ -3,7 +3,7 @@ import Component from "@ember/component";
import { fn } from "@ember/helper";
import { computed } from "@ember/object";
import { alias, equal } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import ChooseTopic from "discourse/components/choose-topic";
import RadioButton from "discourse/components/radio-button";
@@ -39,17 +39,17 @@ export default class ChatToTopicSelector extends Component {
@computed()
get newTopicInstruction() {
- return htmlSafe(this.instructionLabels[NEW_TOPIC_SELECTION]);
+ return trustHTML(this.instructionLabels[NEW_TOPIC_SELECTION]);
}
@computed()
get existingTopicInstruction() {
- return htmlSafe(this.instructionLabels[EXISTING_TOPIC_SELECTION]);
+ return trustHTML(this.instructionLabels[EXISTING_TOPIC_SELECTION]);
}
@computed()
get newMessageInstruction() {
- return htmlSafe(this.instructionLabels[NEW_MESSAGE_SELECTION]);
+ return trustHTML(this.instructionLabels[NEW_MESSAGE_SELECTION]);
}
<template>
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-upload.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-upload.gjs
index 18a8c4b200f..d451986ce0a 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-upload.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-upload.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isAudio, isImage, isVideo } from "discourse/lib/uploads";
import { eq } from "discourse/truth-helpers";
@@ -57,7 +57,9 @@ export default class ChatUpload extends Component {
get imageStyle() {
if (this.args.upload.dominant_color && !this.loaded) {
- return htmlSafe(`background-color: #${this.args.upload.dominant_color};`);
+ return trustHTML(
+ `background-color: #${this.args.upload.dominant_color};`
+ );
}
}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-user-avatar.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-user-avatar.gjs
index 62382019858..fa00d15e9e8 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-user-avatar.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-user-avatar.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import { renderAvatar } from "discourse/helpers/user-avatar";
import { userPath } from "discourse/lib/url";
@@ -10,7 +10,7 @@ export default class ChatUserAvatar extends Component {
@service chat;
get avatar() {
- return htmlSafe(
+ return trustHTML(
renderAvatar(this.args.user, { imageSize: this.avatarSize })
);
}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-pins.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-pins.gjs
index 59e2f706d06..7221dce3cca 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-pins.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-pins.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import replaceEmoji from "discourse/helpers/replace-emoji";
import { i18n } from "discourse-i18n";
import Navbar from "discourse/plugins/chat/discourse/components/chat/navbar";
@@ -13,7 +13,7 @@ export default class ChatDrawerRoutesChannelPins extends Component {
backLinkTitle = i18n("chat.return_to_list");
get title() {
- return htmlSafe(
+ return trustHTML(
i18n("chat.pinned_messages.title") +
" - " +
replaceEmoji(this.args.model.channel.escapedTitle)
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-threads.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-threads.gjs
index 440fe73dbb8..67234639c5a 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-threads.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/drawer-routes/channel-threads.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import replaceEmoji from "discourse/helpers/replace-emoji";
import { i18n } from "discourse-i18n";
import Navbar from "discourse/plugins/chat/discourse/components/chat/navbar";
@@ -13,7 +13,7 @@ export default class ChatDrawerRoutesChannelThreads extends Component {
backLinkTitle = i18n("chat.return_to_list");
get title() {
- return htmlSafe(
+ return trustHTML(
i18n("chat.threads.list") +
" - " +
replaceEmoji(this.args.model.channel.escapedTitle)
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/modal/archive-channel.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/modal/archive-channel.gjs
index 2e21fd5ff19..570e9b3bd5c 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/modal/archive-channel.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/modal/archive-channel.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -74,7 +74,7 @@ export default class ChatModalArchiveChannel extends Component {
}
get instructionsText() {
- return htmlSafe(
+ return trustHTML(
i18n("chat.channel_archive.instructions", {
channelTitle: this.channel.escapedTitle,
})
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/modal/create-channel.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/modal/create-channel.gjs
index 400211bac83..fad0ed8fd8d 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/modal/create-channel.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/modal/create-channel.gjs
@@ -6,7 +6,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { cancel } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isBlank, isPresent } from "@ember/utils";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -24,7 +24,7 @@ import CategoryChooser from "discourse/select-kit/components/category-chooser";
import { not } from "discourse/truth-helpers";
import I18n, { i18n } from "discourse-i18n";
-const DEFAULT_HINT = htmlSafe(
+const DEFAULT_HINT = trustHTML(
i18n("chat.create_channel.choose_category.default_hint", {
link: "/categories",
category: "category",
@@ -238,7 +238,7 @@ export default class ChatModalCreateChannel extends Component {
break;
}
- this.categoryPermissionsHint = htmlSafe(hint);
+ this.categoryPermissionsHint = trustHTML(hint);
})
.finally(() => {
this.loadingPermissionHint = false;
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/modal/delete-channel.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/modal/delete-channel.gjs
index 75f865a7c57..92a5b684bcc 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/modal/delete-channel.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/modal/delete-channel.gjs
@@ -4,7 +4,7 @@ import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -44,7 +44,7 @@ export default class ChatModalDeleteChannel extends Component {
}
get instructionsText() {
- return htmlSafe(
+ return trustHTML(
i18n("chat.channel_delete.instructions", {
name: this.channel.escapedTitle,
})
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/modal/move-message-to-channel.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/modal/move-message-to-channel.gjs
index 559f57e9dae..9d6ebf2b85e 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/modal/move-message-to-channel.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/modal/move-message-to-channel.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isBlank } from "@ember/utils";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -41,7 +41,7 @@ export default class ChatModalMoveMessageToChannel extends Component {
}
get instructionsText() {
- return htmlSafe(
+ return trustHTML(
i18n("chat.move_to_channel.instructions", {
channelTitle: this.sourceChannel.escapedTitle,
count: this.selectedMessageCount,
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/modal/thread-settings.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/modal/thread-settings.gjs
index 738d2d3d03c..b02e1bfd78f 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/modal/thread-settings.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/modal/thread-settings.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { Input } from "@ember/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import icon from "discourse/helpers/d-icon";
@@ -79,7 +79,7 @@ export default class ChatModalThreadSettings extends Component {
<div class="discourse-ai-cta">
<p class="discourse-ai-cta__title">{{icon "circle-info"}}
{{i18n "chat.thread_title_modal.discourse_ai.title"}}</p>
- <p class="discourse-ai-cta__description">{{htmlSafe
+ <p class="discourse-ai-cta__description">{{trustHTML
(i18n
"chat.thread_title_modal.discourse_ai.description"
url="<a href='https://www.discourse.org/ai' rel='noopener noreferrer' target='_blank'>Discourse AI</a>"
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/modal/toggle-channel-status.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/modal/toggle-channel-status.gjs
index c67bb65dcaf..e931e8e2e23 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/modal/toggle-channel-status.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/modal/toggle-channel-status.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { popupAjaxError } from "discourse/lib/ajax-error";
@@ -26,9 +26,9 @@ export default class ChatModalToggleChannelStatus extends Component {
get instructions() {
if (this.channel?.isClosed) {
- return htmlSafe(i18n("chat.channel_open.instructions"));
+ return trustHTML(i18n("chat.channel_open.instructions"));
} else {
- return htmlSafe(i18n("chat.channel_close.instructions"));
+ return trustHTML(i18n("chat.channel_close.instructions"));
}
}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/pinned-messages-list/header.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/pinned-messages-list/header.gjs
index f182bf09aaa..998aea3f464 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/pinned-messages-list/header.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/pinned-messages-list/header.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import replaceEmoji from "discourse/helpers/replace-emoji";
import { i18n } from "discourse-i18n";
import Navbar from "discourse/plugins/chat/discourse/components/chat/navbar";
@@ -17,7 +17,7 @@ export default class ChatPinnedMessagesListHeader extends Component {
title += " - " + replaceEmoji(this.args.channel.escapedTitle);
}
- return htmlSafe(title);
+ return trustHTML(title);
}
<template>
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/thread-list/header.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/thread-list/header.gjs
index 8371609adaa..1031dc34d99 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/thread-list/header.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/thread-list/header.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import replaceEmoji from "discourse/helpers/replace-emoji";
import { i18n } from "discourse-i18n";
import Navbar from "discourse/plugins/chat/discourse/components/chat/navbar";
@@ -17,7 +17,7 @@ export default class ChatThreadListHeader extends Component {
title += " - " + replaceEmoji(this.args.channel.escapedTitle);
}
- return htmlSafe(title);
+ return trustHTML(title);
}
<template>
diff --git a/plugins/chat/assets/javascripts/discourse/components/thread-title/index.gjs b/plugins/chat/assets/javascripts/discourse/components/thread-title/index.gjs
index 0cd1f72ee77..f56374798a6 100644
--- a/plugins/chat/assets/javascripts/discourse/components/thread-title/index.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/thread-title/index.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import replaceEmoji from "discourse/helpers/replace-emoji";
import { escapeExpression } from "discourse/lib/utilities";
import ThreadUnreadIndicator from "discourse/plugins/chat/discourse/components/thread-unread-indicator";
@@ -11,9 +11,9 @@ export default class ChatThreadTitle extends Component {
get title() {
if (this.args.thread.title) {
- return replaceEmoji(htmlSafe(escapeExpression(this.args.thread.title)));
+ return replaceEmoji(trustHTML(escapeExpression(this.args.thread.title)));
} else {
- return replaceEmoji(htmlSafe(this.args.thread.originalMessage.excerpt));
+ return replaceEmoji(trustHTML(this.args.thread.originalMessage.excerpt));
}
}
diff --git a/plugins/chat/assets/javascripts/discourse/components/upsert-category/chat.gjs b/plugins/chat/assets/javascripts/discourse/components/upsert-category/chat.gjs
index 56a419604ea..0e58ae4c4d0 100644
--- a/plugins/chat/assets/javascripts/discourse/components/upsert-category/chat.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/upsert-category/chat.gjs
@@ -5,7 +5,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DToggleSwitch from "discourse/components/d-toggle-switch";
import EmptyState from "discourse/components/empty-state";
@@ -19,7 +19,7 @@ import { or } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
function channelColorStyle(channel) {
- return htmlSafe(`color: #${channel.chatable?.color || "000"}`);
+ return trustHTML(`color: #${channel.chatable?.color || "000"}`);
}
function channelIcon(channel) {
@@ -146,7 +146,7 @@ export default class EditCategoryChat extends Component {
{{else}}
<EmptyState
@title={{i18n "chat.edit_category.no_channels"}}
- @body={{htmlSafe
+ @body={{trustHTML
(i18n
"chat.edit_category.no_channels_body"
chatBrowseUrl=(getURL "/chat/browse/open")
diff --git a/plugins/chat/assets/javascripts/discourse/components/user-menu/chat-notifications-list-empty-state.gjs b/plugins/chat/assets/javascripts/discourse/components/user-menu/chat-notifications-list-empty-state.gjs
index bc549f28a18..12da33a356c 100644
--- a/plugins/chat/assets/javascripts/discourse/components/user-menu/chat-notifications-list-empty-state.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/user-menu/chat-notifications-list-empty-state.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import EmptyState from "discourse/components/empty-state";
import getUrl from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
@@ -6,7 +6,7 @@ import { i18n } from "discourse-i18n";
const ChatNotificationsListEmptyState = <template>
<EmptyState
@title={{i18n "user_menu.no_chat_notifications_title"}}
- @body={{htmlSafe
+ @body={{trustHTML
(i18n
"user_menu.no_chat_notifications_body"
preferencesUrl=(getUrl "/my/preferences/notifications")
diff --git a/plugins/chat/assets/javascripts/discourse/components/user-threads/preview.gjs b/plugins/chat/assets/javascripts/discourse/components/user-threads/preview.gjs
index 9de81ca1494..3b2f07732f9 100644
--- a/plugins/chat/assets/javascripts/discourse/components/user-threads/preview.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/user-threads/preview.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import formatDate from "discourse/helpers/format-date";
import replaceEmoji from "discourse/helpers/replace-emoji";
@@ -18,7 +18,7 @@ export default class ThreadPreview extends Component {
</span>
<span>:</span>
<span class="c-user-thread__excerpt-text">
- {{replaceEmoji (htmlSafe @preview.lastReplyExcerpt)}}
+ {{replaceEmoji (trustHTML @preview.lastReplyExcerpt)}}
</span>
</span>
</template>
diff --git a/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js b/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js
index 2ecc95d3634..d5704e9f6aa 100644
--- a/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js
+++ b/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import getURL from "discourse/lib/get-url";
import User from "discourse/models/user";
import { i18n } from "discourse-i18n";
@@ -21,7 +21,7 @@ export default function formatChatDate(message, options = {}) {
}
if (message.staged) {
- return htmlSafe(
+ return trustHTML(
`<span title='${title}' tabindex="-1" class='chat-time'>${display}</span>`
);
} else {
@@ -34,7 +34,7 @@ export default function formatChatDate(message, options = {}) {
url = getURL(`/chat/c/-/${message.channel.id}/${message.id}`);
}
- return htmlSafe(
+ return trustHTML(
`<a title='${title}' tabindex="-1" class='chat-time' href='${url}'>${display}</a>`
);
}
diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
index 28861716b71..caefc4b6486 100644
--- a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
+++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
@@ -2,7 +2,7 @@ import { tracked } from "@glimmer/tracking";
import { get } from "@ember/object";
import { service } from "@ember/service";
import { dasherize } from "@ember/string";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { decorateUsername } from "discourse/helpers/decorate-username-selector";
import noop from "discourse/helpers/noop";
import { avatarUrl } from "discourse/lib/avatar-utils";
@@ -102,14 +102,14 @@ function createChannelLink(BaseCustomSidebarSectionLink, options = {}) {
return this.channel.displayTitle;
} else {
const username = this.channel.escapedTitle.replaceAll("@", "");
- return htmlSafe(
+ return trustHTML(
`${escapeExpression(username)}${decorateUsername(
escapeExpression(username)
)}`
);
}
} else {
- return htmlSafe(emojiUnescape(this.channel.escapedTitle));
+ return trustHTML(emojiUnescape(this.channel.escapedTitle));
}
}
@@ -126,7 +126,7 @@ function createChannelLink(BaseCustomSidebarSectionLink, options = {}) {
}
} else {
return this.channel.escapedDescription
- ? htmlSafe(this.channel.escapedDescription)
+ ? trustHTML(this.channel.escapedDescription)
: `${this.channel.escapedTitle} ${i18n("chat.title")}`;
}
}
@@ -538,7 +538,7 @@ export default {
}
get text() {
- return htmlSafe(emojiUnescape(this.channel.escapedTitle));
+ return trustHTML(emojiUnescape(this.channel.escapedTitle));
}
get prefixType() {
@@ -555,7 +555,7 @@ export default {
get title() {
return this.channel.escapedDescription
- ? htmlSafe(this.channel.escapedDescription)
+ ? trustHTML(this.channel.escapedDescription)
: `${this.channel.escapedTitle} ${i18n("chat.title")}`;
}
@@ -812,7 +812,7 @@ export default {
"@",
""
);
- return htmlSafe(
+ return trustHTML(
`${escapeExpression(username)}${decorateUsername(
escapeExpression(username)
)}`
diff --git a/plugins/chat/test/javascripts/components/collapser-test.gjs b/plugins/chat/test/javascripts/components/collapser-test.gjs
index f75b73d7fb8..1449a1e3c87 100644
--- a/plugins/chat/test/javascripts/components/collapser-test.gjs
+++ b/plugins/chat/test/javascripts/components/collapser-test.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { click, render } from "@ember/test-helpers";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
@@ -8,7 +8,7 @@ module("Discourse Chat | Component | collapser", function (hooks) {
setupRenderingTest(hooks);
test("renders header", async function (assert) {
- this.set("header", htmlSafe(`<div class="cat">tomtom</div>`));
+ this.set("header", trustHTML(`<div class="cat">tomtom</div>`));
await render(<template><Collapser @header={{this.header}} /></template>);
diff --git a/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/modal/preview.gjs b/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/modal/preview.gjs
index f9ff54df7be..b95f8a4e546 100644
--- a/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/modal/preview.gjs
+++ b/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/modal/preview.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n";
@@ -9,7 +9,7 @@ const Preview = <template>
>
<:body>
<div class="house-ad-preview">
- {{htmlSafe @model.html}}
+ {{trustHTML @model.html}}
</div>
</:body>
</DModal>
diff --git a/plugins/discourse-adplugin/assets/javascripts/discourse/components/amazon-product-links.gjs b/plugins/discourse-adplugin/assets/javascripts/discourse/components/amazon-product-links.gjs
index 486664f3572..eafc29296a9 100644
--- a/plugins/discourse-adplugin/assets/javascripts/discourse/components/amazon-product-links.gjs
+++ b/plugins/discourse-adplugin/assets/javascripts/discourse/components/amazon-product-links.gjs
@@ -1,6 +1,6 @@
import { computed } from "@ember/object";
import { and } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { i18n } from "discourse-i18n";
import AdComponent from "./ad-component";
@@ -147,31 +147,31 @@ export default class AmazonProductLinks extends AdComponent {
@computed("amazon_width", "amazon_height")
get adWrapperStyle() {
- return htmlSafe(
+ return trustHTML(
`width: ${this.amazon_width}px; height: ${this.amazon_height}px;`
);
}
@computed("mobile_amazon_width", "mobile_amazon_height")
get adWrapperStyleMobile() {
- return htmlSafe(
+ return trustHTML(
`width: ${this.mobile_amazon_width}px; height: ${this.mobile_amazon_height}px;`
);
}
@computed("mobile_amazon_width")
get adTitleStyleMobile() {
- return htmlSafe(`width: ${this.mobile_amazon_width}px;`);
+ return trustHTML(`width: ${this.mobile_amazon_width}px;`);
}
@computed("user_input")
get userInput() {
- return htmlSafe(`${this.user_input}`);
+ return trustHTML(`${this.user_input}`);
}
@computed("user_input_mobile")
get userInputMobile() {
- return htmlSafe(`${this.user_input_mobile}`);
+ return trustHTML(`${this.user_input_mobile}`);
}
@computed
diff --git a/plugins/discourse-adplugin/assets/javascripts/discourse/components/carbonads-ad.gjs b/plugins/discourse-adplugin/assets/javascripts/discourse/components/carbonads-ad.gjs
index 7d550cc6e3b..9c5b2b6d3a4 100644
--- a/plugins/discourse-adplugin/assets/javascripts/discourse/components/carbonads-ad.gjs
+++ b/plugins/discourse-adplugin/assets/javascripts/discourse/components/carbonads-ad.gjs
@@ -1,5 +1,5 @@
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdComponent from "./ad-component";
export default class CarbonadsAd extends AdComponent {
@@ -14,7 +14,7 @@ export default class CarbonadsAd extends AdComponent {
@computed("serve_id", "placement")
get url() {
- return htmlSafe(
+ return trustHTML(
`//cdn.carbonads.com/carbon.js?serve=${this.serve_id}&placement=${this.placement}`
);
}
diff --git a/plugins/discourse-adplugin/assets/javascripts/discourse/components/google-adsense.gjs b/plugins/discourse-adplugin/assets/javascripts/discourse/components/google-adsense.gjs
index 5f44978ec15..0fac9720045 100644
--- a/plugins/discourse-adplugin/assets/javascripts/discourse/components/google-adsense.gjs
+++ b/plugins/discourse-adplugin/assets/javascripts/discourse/components/google-adsense.gjs
@@ -1,6 +1,6 @@
import { computed } from "@ember/object";
import { scheduleOnce } from "@ember/runloop";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import RSVP from "rsvp";
import concatClass from "discourse/helpers/concat-class";
@@ -183,19 +183,19 @@ export default class GoogleAdsense extends AdComponent {
@computed("placement", "showAd")
get classForSlot() {
- return this.showAd ? htmlSafe(`adsense-${this.placement}`) : "";
+ return this.showAd ? trustHTML(`adsense-${this.placement}`) : "";
}
@computed("isResponsive", "isFluid")
get autoAdFormat() {
return this.isResponsive
- ? htmlSafe(this.isFluid ? "fluid" : "auto")
+ ? trustHTML(this.isFluid ? "fluid" : "auto")
: false;
}
@computed("ad_width", "ad_height", "isResponsive")
get adWrapperStyle() {
- return htmlSafe(
+ return trustHTML(
this.isResponsive
? ""
: `width: ${this.ad_width}; height: ${this.ad_height};`
@@ -204,7 +204,7 @@ export default class GoogleAdsense extends AdComponent {
@computed("adWrapperStyle", "isResponsive")
get adInsStyle() {
- return htmlSafe(
+ return trustHTML(
`display: ${this.isResponsive ? "block" : "inline-block"}; ${this.adWrapperStyle}`
);
}
diff --git a/plugins/discourse-adplugin/assets/javascripts/discourse/components/google-dfp-ad.gjs b/plugins/discourse-adplugin/assets/javascripts/discourse/components/google-dfp-ad.gjs
index 2ba4e34afe7..8f69adfcdf4 100644
--- a/plugins/discourse-adplugin/assets/javascripts/discourse/components/google-dfp-ad.gjs
+++ b/plugins/discourse-adplugin/assets/javascripts/discourse/components/google-dfp-ad.gjs
@@ -1,6 +1,6 @@
import { computed } from "@ember/object";
import { alias } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { on } from "@ember-decorators/object";
import RSVP from "rsvp";
@@ -297,14 +297,14 @@ export default class GoogleDfpAd extends AdComponent {
@computed("width", "height")
get adWrapperStyle() {
if (this.width !== "fluid") {
- return htmlSafe(`width: ${this.width}px; height: ${this.height}px;`);
+ return trustHTML(`width: ${this.width}px; height: ${this.height}px;`);
}
}
@computed("width")
get adTitleStyleMobile() {
if (this.width !== "fluid") {
- return htmlSafe(`width: ${this.width}px;`);
+ return trustHTML(`width: ${this.width}px;`);
}
}
diff --git a/plugins/discourse-adplugin/assets/javascripts/discourse/components/house-ad.gjs b/plugins/discourse-adplugin/assets/javascripts/discourse/components/house-ad.gjs
index 3486f0cae16..14020803afa 100644
--- a/plugins/discourse-adplugin/assets/javascripts/discourse/components/house-ad.gjs
+++ b/plugins/discourse-adplugin/assets/javascripts/discourse/components/house-ad.gjs
@@ -1,5 +1,5 @@
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isBlank } from "@ember/utils";
import { tagName } from "@ember-decorators/component";
import concatClass from "discourse/helpers/concat-class";
@@ -190,7 +190,7 @@ export default class HouseAd extends AdComponent {
<template>
<div class={{concatClass "house-creative" this.adUnitClass}} ...attributes>
{{#if this.showAd}}
- {{htmlSafe this.adHtml}}
+ {{trustHTML this.adHtml}}
{{/if}}
</div>
</template>
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-agent-editor.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-agent-editor.gjs
index 9f0dfac06cc..866221bb7e6 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-agent-editor.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-agent-editor.gjs
@@ -7,7 +7,7 @@ import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { LinkTo } from "@ember/routing";
import { later } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminUser from "discourse/admin/models/admin-user";
import BackButton from "discourse/components/back-button";
import Form from "discourse/components/form";
@@ -299,7 +299,7 @@ export default class AgentEditor extends Component {
toolTokenBarStyle(tools) {
const total = this.totalToolTokens(tools);
const percent = Math.min(100, (total / TOOL_TOKEN_BAR_MAX) * 100);
- return htmlSafe(`width: ${percent}%`);
+ return trustHTML(`width: ${percent}%`);
}
@action
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llms-list-editor.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llms-list-editor.gjs
index cb757f63691..b6aea76e1ff 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llms-list-editor.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llms-list-editor.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { concat, fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminSectionLandingItem from "discourse/admin/components/admin-section-landing-item";
import AdminSectionLandingWrapper from "discourse/admin/components/admin-section-landing-wrapper";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
@@ -200,7 +200,7 @@ export default class AiLlmsListEditor extends Component {
{{#if llm.llm_credit_allocation.hard_limit_reached}}
<div class="alert alert-danger ai-credit-warning">
{{icon "circle-info"}}
- {{htmlSafe
+ {{trustHTML
(i18n
"discourse_ai.llms.credit_allocation.hard_limit_warning"
reset_date=(this.formatResetDate
@@ -214,7 +214,7 @@ export default class AiLlmsListEditor extends Component {
}}
<div class="alert alert-warning ai-credit-warning">
{{icon "circle-info"}}
- {{htmlSafe
+ {{trustHTML
(i18n
"discourse_ai.llms.credit_allocation.soft_limit_warning"
percentage=llm.llm_credit_allocation.percentage_remaining
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-translations.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-translations.gjs
index 172e423beaf..4082b714c1c 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-translations.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-translations.gjs
@@ -4,7 +4,7 @@ import { hash } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import AdminConfigAreaCard from "discourse/admin/components/admin-config-area-card";
import Chart from "discourse/admin/components/chart";
import DButton from "discourse/components/d-button";
@@ -72,13 +72,13 @@ export default class AiTranslations extends Component {
this.creditStatus?.reset_time_formatted ||
this.creditStatus?.reset_time_absolute;
if (resetTime) {
- return htmlSafe(
+ return trustHTML(
i18n("discourse_ai.translations.credit_limit_warning", {
reset_time: resetTime,
})
);
}
- return htmlSafe(
+ return trustHTML(
i18n("discourse_ai.translations.credit_limit_warning_no_time")
);
}
@@ -287,7 +287,7 @@ export default class AiTranslations extends Component {
});
}
- return htmlSafe(
+ return trustHTML(
i18n("discourse_ai.translations.stats.backfill_message", {
date: formattedDate,
eta: timeKey,
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-artifact.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-artifact.gjs
index 3d91001586b..4b939437f2a 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-artifact.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-artifact.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import htmlClass from "discourse/helpers/html-class";
import getURL from "discourse/lib/get-url";
@@ -119,7 +119,7 @@ export default class AiArtifactComponent extends Component {
height = 2000; // cap the height to a maximum of 2000px
}
- return htmlSafe(`height: ${height}px;`);
+ return trustHTML(`height: ${height}px;`);
}
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
index 6cd6276e534..a519cf74296 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
@@ -8,7 +8,7 @@ import { getOwner } from "@ember/owner";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { scheduleOnce } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { TrackedArray } from "@ember-compat/tracked-built-ins";
import { tagName } from "@ember-decorators/component";
import { modifier } from "ember-modifier";
@@ -60,7 +60,7 @@ export default class AiBotConversations extends Component {
const instance = this.tooltip.register(element, {
identifier: "ai-credit-limit-tooltip",
- content: htmlSafe(
+ content: trustHTML(
this.aiCredits.getCreditLimitMessage(this.creditStatus)
),
placement: "top",
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-credit-bar.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-credit-bar.gjs
index 6bb32f6d413..3b7a1bbc627 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-credit-bar.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-credit-bar.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DTooltip from "discourse/float-kit/components/d-tooltip";
import concatClass from "discourse/helpers/concat-class";
import { number } from "discourse/lib/formatter";
@@ -26,7 +26,7 @@ export default class AiCreditBar extends Component {
}
get fillStyle() {
- return htmlSafe(`width: ${this.args.allocation.percentage_remaining}%`);
+ return trustHTML(`width: ${this.args.allocation.percentage_remaining}%`);
}
get barText() {
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-sentiment-horizontal-bar.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-sentiment-horizontal-bar.gjs
index e76006f705d..68249015ceb 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-sentiment-horizontal-bar.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-sentiment-horizontal-bar.gjs
@@ -1,5 +1,5 @@
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DTooltip from "discourse/float-kit/components/d-tooltip";
import { gt } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
@@ -8,7 +8,7 @@ const AiSentimentHorizontalBar = <template>
{{#if (gt @score 0)}}
<DTooltip
class={{concat "sentiment-horizontal-bar__" @type}}
- style={{htmlSafe (concat "width: " @width "%")}}
+ style={{trustHTML (concat "width: " @width "%")}}
>
<:trigger>
<span class="sentiment-horizontal-bar__count">
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-topic-gist.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-topic-gist.gjs
index caab71adbde..4b7866afea5 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-topic-gist.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-topic-gist.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import bodyClass from "discourse/helpers/body-class";
import { TABLE_AI_LAYOUT } from "../services/gists";
@@ -42,7 +42,7 @@ export default class AiTopicGist extends Component {
{{#if this.escapedExcerpt}}
<a href={{@topic.lastUnreadUrl}} class="excerpt">
<div class="excerpt__contents">
- {{htmlSafe this.escapedExcerpt}}
+ {{trustHTML this.escapedExcerpt}}
</div>
</a>
{{/if}}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/modal/debug-ai-modal.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/modal/debug-ai-modal.gjs
index 785cb6c7402..ee0a7a233d7 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/modal/debug-ai-modal.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/modal/debug-ai-modal.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { next } from "@ember/runloop";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { ajax } from "discourse/lib/ajax";
@@ -50,7 +50,7 @@ export default class DebugAiModal extends Component {
const split = response.split("\n");
const safe = split.map((line) => escapeExpression(line)).join("<br>");
- return htmlSafe(safe);
+ return trustHTML(safe);
}
@action
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/modal/diff-modal.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/modal/diff-modal.gjs
index 3baa91f0e84..ba3a3b93bfe 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/modal/diff-modal.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/modal/diff-modal.gjs
@@ -4,7 +4,7 @@ import { action } from "@ember/object";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import CookText from "discourse/components/cook-text";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
@@ -222,7 +222,7 @@ export default class ModalDiffModal extends Component {
}}
>
{{~#if @model.showResultAsDiff~}}
- <span class="diff-inner">{{htmlSafe this.diffResult}}</span>
+ <span class="diff-inner">{{trustHTML this.diffResult}}</span>
{{else}}
{{#if (or this.loading this.smoothStreamer.isStreaming)}}
<CookText
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs
index d2987578ce1..92a4ffefa23 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/modal/share-full-topic-modal.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { ajax } from "discourse/lib/ajax";
@@ -29,7 +29,7 @@ export default class ShareModal extends Component {
context.push(`<p><b>${post.username}:</b></p>`);
context.push(post.cooked);
});
- return htmlSafe(context.join("\n"));
+ return trustHTML(context.join("\n"));
}
async generateShareURL() {
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/modal/share-modal.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/modal/share-modal.gjs
index be62d467e02..eb3651c139b 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/modal/share-modal.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/modal/share-modal.gjs
@@ -4,7 +4,7 @@ import { Input } from "@ember/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import discourseLater from "discourse/lib/later";
@@ -58,7 +58,7 @@ export default class ShareModal extends Component {
context.push(`<p><b>${post.username}:</b></p>`);
context.push(post.cooked);
}
- this.htmlContext = htmlSafe(context.join("\n"));
+ this.htmlContext = trustHTML(context.join("\n"));
}
@action
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/connectors/topic-map-expanded-after/ai-summary-trigger.gjs b/plugins/discourse-ai/assets/javascripts/discourse/connectors/topic-map-expanded-after/ai-summary-trigger.gjs
index 0a163335a13..f4816ba68a5 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/connectors/topic-map-expanded-after/ai-summary-trigger.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/connectors/topic-map-expanded-after/ai-summary-trigger.gjs
@@ -4,7 +4,7 @@ import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import DButton from "discourse/components/d-button";
import AiSummaryModal from "../../components/modal/ai-summary-modal";
@@ -25,7 +25,7 @@ export default class AiSummaryTrigger extends Component {
const instance = this.tooltip.register(element, {
identifier: "ai-credit-limit-tooltip",
- content: htmlSafe(
+ content: trustHTML(
this.aiCredits.getCreditLimitMessage(this.creditStatus)
),
placement: "top",
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-errors.js b/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-errors.js
index fd96852d9cb..f98a3944c9f 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-errors.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-errors.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { getOwnerWithFallback } from "discourse/lib/get-owner";
import { i18n } from "discourse-i18n";
@@ -80,6 +80,6 @@ export function popupAiCreditLimitError(errorOrPayload) {
dialog.alert({
title: i18n("discourse_ai.errors.credit_limit_dialog.title"),
- message: htmlSafe(message),
+ message: trustHTML(message),
});
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/lib/utilities.js b/plugins/discourse-ai/assets/javascripts/discourse/lib/utilities.js
index 76a945ee680..4112b2f9028 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/lib/utilities.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/lib/utilities.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { escapeExpression } from "discourse/lib/utilities";
/**
@@ -46,5 +46,5 @@ export function jsonToHtml(json) {
}
html += "</ul>";
- return htmlSafe(html);
+ return trustHTML(html);
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/services/ai-conversations-sidebar-manager.js b/plugins/discourse-ai/assets/javascripts/discourse/services/ai-conversations-sidebar-manager.js
index f157b962333..016036a8979 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/services/ai-conversations-sidebar-manager.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/services/ai-conversations-sidebar-manager.js
@@ -1,7 +1,7 @@
import { tracked } from "@glimmer/tracking";
import { scheduleOnce } from "@ember/runloop";
import Service, { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { TrackedArray } from "@ember-compat/tracked-built-ins";
import { ajax } from "discourse/lib/ajax";
import discourseDebounce from "discourse/lib/debounce";
@@ -335,7 +335,7 @@ export default class AiConversationsSidebarManager extends Service {
}
get text() {
- return htmlSafe(sec.title);
+ return trustHTML(sec.title);
}
get links() {
diff --git a/plugins/discourse-assign/assets/javascripts/discourse/components/assigned-to-first-post.gjs b/plugins/discourse-assign/assets/javascripts/discourse/components/assigned-to-first-post.gjs
index 4854d8130c9..2f443098400 100644
--- a/plugins/discourse-assign/assets/javascripts/discourse/components/assigned-to-first-post.gjs
+++ b/plugins/discourse-assign/assets/javascripts/discourse/components/assigned-to-first-post.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
import { bind } from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
@@ -72,7 +72,7 @@ export default class AssignedToFirstPost extends Component {
{{#if this.assignedToUser}}
<span class="assignee">
<span class="assigned-to--user">
- {{htmlSafe
+ {{trustHTML
(i18n
"discourse_assign.assigned_topic_to"
username=(this.prioritizedAssigneeName this.assignedToUser)
@@ -86,7 +86,7 @@ export default class AssignedToFirstPost extends Component {
{{#if this.assignedToGroup}}
<span class="assignee">
<span class="assigned-to--group">
- {{htmlSafe
+ {{trustHTML
(i18n
"discourse_assign.assigned_topic_to"
username=this.assignedToGroup.name
diff --git a/plugins/discourse-assign/assets/javascripts/discourse/components/topic-level-assign-menu.js b/plugins/discourse-assign/assets/javascripts/discourse/components/topic-level-assign-menu.js
index b702a94cee6..ce2ea7158f9 100644
--- a/plugins/discourse-assign/assets/javascripts/discourse/components/topic-level-assign-menu.js
+++ b/plugins/discourse-assign/assets/javascripts/discourse/components/topic-level-assign-menu.js
@@ -1,5 +1,5 @@
import { getOwner } from "@ember/owner";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { renderAvatar } from "discourse/helpers/user-avatar";
import { iconHTML } from "discourse/lib/icon-library";
import { i18n } from "discourse-i18n";
@@ -120,8 +120,8 @@ function editAssignmentsButton() {
const label = i18n("discourse_assign.topic_level_menu.edit_assignments");
return {
id: "reassign",
- name: htmlSafe(label),
- label: htmlSafe(`${icon} ${label}`),
+ name: trustHTML(label),
+ label: trustHTML(`${icon} ${label}`),
};
}
@@ -130,8 +130,8 @@ function reassignToSelfButton() {
const label = i18n("discourse_assign.topic_level_menu.reassign_topic_to_me");
return {
id: "reassign-self",
- name: htmlSafe(label),
- label: htmlSafe(`${icon} ${label}`),
+ name: trustHTML(label),
+ label: trustHTML(`${icon} ${label}`),
};
}
@@ -152,8 +152,8 @@ function unassignFromTopicButton(topic, prioritize_full_name_in_ux) {
return {
id: "unassign",
- name: htmlSafe(label),
- label: htmlSafe(`${icon} ${label}`),
+ name: trustHTML(label),
+ label: trustHTML(`${icon} ${label}`),
};
}
@@ -192,8 +192,8 @@ function unassignFromPostButton(postId, assignment) {
);
return {
id: `unassign-from-post-${postId}`,
- name: htmlSafe(dataName),
- label: htmlSafe(`${icon} ${label}`),
+ name: trustHTML(dataName),
+ label: trustHTML(`${icon} ${label}`),
};
}
@@ -205,10 +205,10 @@ function topicLevelUnassignButton(assignees) {
return {
id: null,
- name: htmlSafe(
+ name: trustHTML(
i18n("discourse_assign.topic_level_menu.unassign_with_ellipsis")
),
- label: htmlSafe(`${avatars}${label}`),
+ label: trustHTML(`${avatars}${label}`),
};
}
diff --git a/plugins/discourse-assign/assets/javascripts/discourse/components/user-menu/assigns-list-empty-state.gjs b/plugins/discourse-assign/assets/javascripts/discourse/components/user-menu/assigns-list-empty-state.gjs
index 5505e56621d..f28046b2f4b 100644
--- a/plugins/discourse-assign/assets/javascripts/discourse/components/user-menu/assigns-list-empty-state.gjs
+++ b/plugins/discourse-assign/assets/javascripts/discourse/components/user-menu/assigns-list-empty-state.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
import getUrl from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
@@ -10,7 +10,7 @@ const AssignsListEmptyState = <template>
</span>
<div class="empty-state-body">
<p>
- {{htmlSafe
+ {{trustHTML
(i18n
"user.no_assignments_body"
icon=(icon "user-plus")
diff --git a/plugins/discourse-assign/assets/javascripts/discourse/controllers/user-activity/assigned.js b/plugins/discourse-assign/assets/javascripts/discourse/controllers/user-activity/assigned.js
index a5ab23512ee..3793a006c3a 100644
--- a/plugins/discourse-assign/assets/javascripts/discourse/controllers/user-activity/assigned.js
+++ b/plugins/discourse-assign/assets/javascripts/discourse/controllers/user-activity/assigned.js
@@ -1,6 +1,6 @@
import { inject as controller } from "@ember/controller";
import { action, computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import UserTopicsList from "discourse/controllers/user-topics-list";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse/lib/environment";
@@ -23,7 +23,7 @@ export default class UserActivityAssigned extends UserTopicsList {
@computed
get emptyStateBody() {
- return htmlSafe(
+ return trustHTML(
i18n("user.no_assignments_body", {
preferencesUrl: getURL("/my/preferences/notifications"),
icon: iconHTML("user-plus"),
diff --git a/plugins/discourse-assign/assets/javascripts/discourse/initializers/assign-user-menu.js b/plugins/discourse-assign/assets/javascripts/discourse/initializers/assign-user-menu.js
index 489f4c5ef16..f6afbe69147 100644
--- a/plugins/discourse-assign/assets/javascripts/discourse/initializers/assign-user-menu.js
+++ b/plugins/discourse-assign/assets/javascripts/discourse/initializers/assign-user-menu.js
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { withPluginApi } from "discourse/lib/plugin-api";
import { emojiUnescape } from "discourse/lib/text";
import { i18n } from "discourse-i18n";
@@ -45,7 +45,7 @@ export default {
}
get description() {
- return htmlSafe(
+ return trustHTML(
emojiUnescape(
i18n(`user.assignment_description.${this.postOrTopic()}`, {
topic_title: this.notification.fancy_title,
diff --git a/plugins/discourse-assign/assets/javascripts/discourse/initializers/extend-for-assigns.js b/plugins/discourse-assign/assets/javascripts/discourse/initializers/extend-for-assigns.js
index db2fd156cfd..6a33d533178 100644
--- a/plugins/discourse-assign/assets/javascripts/discourse/initializers/extend-for-assigns.js
+++ b/plugins/discourse-assign/assets/javascripts/discourse/initializers/extend-for-assigns.js
@@ -1,6 +1,6 @@
import { computed } from "@ember/object";
import { getOwner } from "@ember/owner";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { renderAvatar } from "discourse/helpers/user-avatar";
import getURL from "discourse/lib/get-url";
import { iconHTML } from "discourse/lib/icon-library";
@@ -111,7 +111,7 @@ function registerTopicFooterButtons(api) {
const label = i18n("discourse_assign.assigned_to");
if (user) {
- return htmlSafe(
+ return trustHTML(
`<span class="unassign-label"><span class="text">${label}&nbsp;</span><span class="username">${
user.username
}</span></span>&nbsp;${renderAvatar(user, {
@@ -120,7 +120,7 @@ function registerTopicFooterButtons(api) {
})}`
);
} else if (group) {
- return htmlSafe(
+ return trustHTML(
`<span class="unassign-label">${label}</span> @${group.name}`
);
}
@@ -150,7 +150,7 @@ function registerTopicFooterButtons(api) {
translatedLabel() {
const label = i18n("discourse_assign.unassign.title");
- return htmlSafe(
+ return trustHTML(
`<span class="unassign-label"><span class="text">${label}</span></span>`
);
},
@@ -194,7 +194,7 @@ function registerTopicFooterButtons(api) {
translatedLabel() {
const label = i18n("discourse_assign.reassign.to_self");
- return htmlSafe(
+ return trustHTML(
`<span class="unassign-label"><span class="text">${label}</span></span>`
);
},
@@ -240,7 +240,7 @@ function registerTopicFooterButtons(api) {
translatedLabel() {
const label = i18n("discourse_assign.reassign.title_w_ellipsis");
- return htmlSafe(
+ return trustHTML(
`<span class="unassign-label"><span class="text">${label}</span></span>`
);
},
diff --git a/plugins/discourse-cakeday/assets/javascripts/discourse/components/emoji-images.gjs b/plugins/discourse-cakeday/assets/javascripts/discourse/components/emoji-images.gjs
index cf35216ced6..900fdae55c1 100644
--- a/plugins/discourse-cakeday/assets/javascripts/discourse/components/emoji-images.gjs
+++ b/plugins/discourse-cakeday/assets/javascripts/discourse/components/emoji-images.gjs
@@ -1,7 +1,7 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import icon from "discourse/helpers/d-icon";
import { emojiUnescape } from "discourse/lib/text";
@@ -26,7 +26,7 @@ export default class EmojiImages extends Component {
{{#if this.siteSettings.enable_emoji}}
<div title={{this.titleText}}>
{{#each this.emojiHTML as |html|}}
- {{htmlSafe html}}
+ {{trustHTML html}}
{{/each}}
</div>
{{else}}
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/dates.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/dates.gjs
index 18cc3aaef72..cca488ef901 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/dates.gjs
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/dates.gjs
@@ -4,7 +4,7 @@ import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { schedule } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
import { bbcodeAttributeEncode } from "discourse/lib/bbcode-attributes";
import { generateIcsData } from "discourse/lib/download-calendar";
@@ -170,7 +170,7 @@ export default class DiscoursePostEventDates extends Component {
if (this.siteSettings.discourse_local_dates_enabled) {
const bbcode = this.datesBBCode.join("<span> → </span>");
const result = await cook(bbcode);
- this.htmlDates = htmlSafe(result.toString());
+ this.htmlDates = trustHTML(result.toString());
// doesn’t work reliably without discourseLater
discourseLater(() => {
@@ -195,7 +195,7 @@ export default class DiscoursePostEventDates extends Component {
const endFormatted = moment(this.endsAt).format(this.endsAtFormat);
dates += ` → ${endFormatted}`;
}
- this.htmlDates = htmlSafe(dates);
+ this.htmlDates = trustHTML(dates);
}
}
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/full-calendar.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/full-calendar.gjs
index cf3fcb60e3e..cdf4c542945 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/full-calendar.gjs
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/full-calendar.gjs
@@ -4,7 +4,7 @@ import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier as modifierFn } from "ember-modifier";
import loadFullCalendar from "discourse/lib/load-full-calendar";
import DiscourseURL from "discourse/lib/url";
@@ -121,7 +121,7 @@ export default class FullCalendar extends Component {
this.activeTooltip = await this.tooltip.show(el, {
identifier: "post-event-tooltip",
triggers: ["hover"],
- content: htmlSafe(
+ content: trustHTML(
// this is a workaround to allow linebreaks in the tooltip
"<div>" + htmlContent + "</div>"
),
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/post-calendar.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/post-calendar.gjs
index 3fb99fe05c8..2b9ac4d36be 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/post-calendar.gjs
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/post-calendar.gjs
@@ -3,7 +3,7 @@ import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import getURL from "discourse/lib/get-url";
import { escapeExpression } from "discourse/lib/utilities";
import { colorToHex, contrastColor, stringToColor } from "../lib/colors";
@@ -267,7 +267,7 @@ export default class PostCalendar extends Component {
if (detail.message.length > 100) {
popupText += "…";
}
- event.extendedProps.htmlContent = htmlSafe(escapeExpression(popupText));
+ event.extendedProps.htmlContent = trustHTML(escapeExpression(popupText));
event.title = event.title.replace(/<img[^>]*>/g, "");
event.participantCount = 1;
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/helpers/format-future-date.js b/plugins/discourse-calendar/assets/javascripts/discourse/helpers/format-future-date.js
index 59071752f06..9e78486c90d 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/helpers/format-future-date.js
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/helpers/format-future-date.js
@@ -1,8 +1,8 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import guessDateFormat from "../lib/guess-best-date-format";
export default function (date) {
date = moment.utc(date).tz(moment.tz.guess());
const format = guessDateFormat(date);
- return htmlSafe(date.format(format));
+ return trustHTML(date.format(format));
}
diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/modal/query-help.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/modal/query-help.gjs
index 6d6daa3971a..a73597fb497 100644
--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/modal/query-help.gjs
+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/modal/query-help.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n";
@@ -8,10 +8,10 @@ const QueryHelp = <template>
@closeModal={{@closeModal}}
>
<:body>
- {{htmlSafe (i18n "explorer.help.auto_resolution")}}
- {{htmlSafe (i18n "explorer.help.custom_params")}}
- {{htmlSafe (i18n "explorer.help.default_values")}}
- {{htmlSafe (i18n "explorer.help.data_types")}}
+ {{trustHTML (i18n "explorer.help.auto_resolution")}}
+ {{trustHTML (i18n "explorer.help.custom_params")}}
+ {{trustHTML (i18n "explorer.help.default_values")}}
+ {{trustHTML (i18n "explorer.help.data_types")}}
</:body>
</DModal>
</template>;
diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/badge.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/badge.gjs
index f51b5769dd6..f97329cfe61 100644
--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/badge.gjs
+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/badge.gjs
@@ -1,5 +1,5 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { convertIconClass, iconHTML } from "discourse/lib/icon-library";
@@ -11,9 +11,9 @@ export default class Badge extends Component {
if (this.args.ctx.badge.icon.indexOf("fa-") > -1) {
const icon = iconHTML(convertIconClass(this.args.ctx.badge.icon));
- return htmlSafe(icon);
+ return trustHTML(icon);
} else {
- return htmlSafe("<img src='" + this.args.ctx.badge.icon + "'>");
+ return trustHTML("<img src='" + this.args.ctx.badge.icon + "'>");
}
}
diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/html.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/html.gjs
index e2166ca4295..efe0df591da 100644
--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/html.gjs
+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/html.gjs
@@ -1,5 +1,5 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
-const Html = <template>{{htmlSafe @ctx.value}}</template>;
+const Html = <template>{{trustHTML @ctx.value}}</template>;
export default Html;
diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/post.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/post.gjs
index b2f2e6106c9..057dd342738 100644
--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/post.gjs
+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/post.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import avatar from "discourse/helpers/avatar";
const Post = <template>
@@ -29,7 +29,7 @@ const Post = <template>
<blockquote>
<p>
- {{htmlSafe @ctx.post.excerpt}}
+ {{trustHTML @ctx.post.excerpt}}
</p>
</blockquote>
</aside>
diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/reltime.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/reltime.gjs
index c44a61d1419..6f2416ebf33 100644
--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/reltime.gjs
+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/reltime.gjs
@@ -1,10 +1,10 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
export default class Reltime extends Component {
get boundDateReplacement() {
- return htmlSafe(
+ return trustHTML(
autoUpdatingRelativeAge(new Date(this.args.ctx.value), { title: true })
);
}
diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/topic.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/topic.gjs
index 308e7e0cbdf..bec4393207b 100644
--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/topic.gjs
+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/topic.gjs
@@ -1,9 +1,9 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
const Topic = <template>
{{#if @ctx.topic}}
<a href="{{@ctx.baseuri}}/t/{{@ctx.topic.slug}}/{{@ctx.topic.id}}">
- {{htmlSafe @ctx.topic.fancy_title}}
+ {{trustHTML @ctx.topic.fancy_title}}
</a>
({{@ctx.topic.posts_count}})
{{else}}
diff --git a/plugins/discourse-gamification/assets/javascripts/discourse/components/modal/leaderboard-info.gjs b/plugins/discourse-gamification/assets/javascripts/discourse/components/modal/leaderboard-info.gjs
index 5ababb1588c..3b62147a484 100644
--- a/plugins/discourse-gamification/assets/javascripts/discourse/components/modal/leaderboard-info.gjs
+++ b/plugins/discourse-gamification/assets/javascripts/discourse/components/modal/leaderboard-info.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DModal from "discourse/components/d-modal";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
@@ -11,7 +11,7 @@ const LeaderboardInfo = <template>
>
<:body>
{{icon "award"}}
- {{htmlSafe (i18n "gamification.leaderboard.modal.text")}}
+ {{trustHTML (i18n "gamification.leaderboard.modal.text")}}
</:body>
</DModal>
</template>;
diff --git a/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-video.gjs b/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-video.gjs
index 5525bca614a..7e3897ea5ac 100644
--- a/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-video.gjs
+++ b/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-video.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { concat } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import { i18n } from "discourse-i18n";
import LazyIframe from "./lazy-iframe";
@@ -14,7 +14,7 @@ export default class LazyVideo extends Component {
get thumbnailStyle() {
const color = this.args.videoAttributes.dominantColor;
if (color?.match(/^[0-9A-Fa-f]+$/)) {
- return htmlSafe(`background-color: #${color};`);
+ return trustHTML(`background-color: #${color};`);
}
}
diff --git a/plugins/discourse-local-dates/assets/javascripts/discourse/components/modal/local-dates-create.gjs b/plugins/discourse-local-dates/assets/javascripts/discourse/components/modal/local-dates-create.gjs
index b581178f1ba..596b19236b8 100644
--- a/plugins/discourse-local-dates/assets/javascripts/discourse/components/modal/local-dates-create.gjs
+++ b/plugins/discourse-local-dates/assets/javascripts/discourse/components/modal/local-dates-create.gjs
@@ -5,7 +5,7 @@ import { on } from "@ember/modifier";
import EmberObject, { action, computed } from "@ember/object";
import { notEmpty } from "@ember/object/computed";
import { schedule } from "@ember/runloop";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { observes } from "@ember-decorators/object";
import CalendarDateTimeInput from "discourse/components/calendar-date-time-input";
@@ -503,7 +503,7 @@ export default class LocalDatesCreate extends Component {
<label class="control-label">
{{i18n "discourse_local_dates.create.form.recurring_title"}}
</label>
- <p>{{htmlSafe
+ <p>{{trustHTML
(i18n
"discourse_local_dates.create.form.recurring_description"
)
diff --git a/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js b/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js
index 86c31f8fcc4..b842236f012 100644
--- a/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js
+++ b/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js
@@ -1,7 +1,7 @@
import { setOwner } from "@ember/owner";
import { service } from "@ember/service";
import { dasherize } from "@ember/string";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { bbcodeAttributeDecode } from "discourse/lib/bbcode-attributes";
import { bind } from "discourse/lib/decorators";
import { downloadCalendar } from "discourse/lib/download-calendar";
@@ -409,7 +409,7 @@ class LocalDatesInit {
return this.tooltip.show(event.target, {
identifier: "local-date",
- content: htmlSafe(buildHtmlPreview(event.target, this.siteSettings)),
+ content: trustHTML(buildHtmlPreview(event.target, this.siteSettings)),
});
}
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjs b/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjs
index a96112278b5..d8d9bf9646b 100644
--- a/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjs
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjs
@@ -1,7 +1,7 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import DButton from "discourse/components/d-button";
import icon from "discourse/helpers/d-icon";
@@ -85,7 +85,7 @@ export default class Patreon extends Component {
{{#if this.model.patreon_declined_since}}
<div class="display-row">
<div class="field">{{i18n "patreon.field.declined_since"}}</div>
- <div class="value">{{htmlSafe
+ <div class="value">{{trustHTML
this.format-date
this.model.patreon_declined_since
}}</div>
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/connectors/topic-above-footer-buttons/patreon.gjs b/plugins/discourse-patreon/assets/javascripts/discourse/connectors/topic-above-footer-buttons/patreon.gjs
index 176c40d1754..4e2144afe50 100644
--- a/plugins/discourse-patreon/assets/javascripts/discourse/connectors/topic-above-footer-buttons/patreon.gjs
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/connectors/topic-above-footer-buttons/patreon.gjs
@@ -2,7 +2,7 @@
import Component from "@ember/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNames, tagName } from "@ember-decorators/component";
import $ from "jquery";
import icon from "discourse/helpers/d-icon";
@@ -54,7 +54,7 @@ export default class Patreon extends Component {
{{icon "xmark"}}
</span>
- {{htmlSafe
+ {{trustHTML
(i18n
"patreon.donation_prompt.body"
campaignUrl=this.siteSettings.patreon_donation_prompt_campaign_url
diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/templates/admin/plugins-patreon.gjs b/plugins/discourse-patreon/assets/javascripts/discourse/templates/admin/plugins-patreon.gjs
index 8ac688002ff..ae3d1c26d86 100644
--- a/plugins/discourse-patreon/assets/javascripts/discourse/templates/admin/plugins-patreon.gjs
+++ b/plugins/discourse-patreon/assets/javascripts/discourse/templates/admin/plugins-patreon.gjs
@@ -1,4 +1,4 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import formatDate from "discourse/helpers/format-date";
import ComboBox from "discourse/select-kit/components/combo-box";
@@ -78,7 +78,7 @@ export default <template>
{{#if @controller.last_sync_at}}
<span class="last_synced">
{{i18n "patreon.last_synced"}}:
- {{htmlSafe (formatDate @controller.last_sync_at leaveAgo="true")}}
+ {{trustHTML (formatDate @controller.last_sync_at leaveAgo="true")}}
</span>
{{/if}}
</section>
diff --git a/plugins/discourse-post-voting/assets/javascripts/discourse/components/post-voting-comment.gjs b/plugins/discourse-post-voting/assets/javascripts/discourse/components/post-voting-comment.gjs
index 059f4be4b33..ae9d4b88892 100644
--- a/plugins/discourse-post-voting/assets/javascripts/discourse/components/post-voting-comment.gjs
+++ b/plugins/discourse-post-voting/assets/javascripts/discourse/components/post-voting-comment.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import formatDate from "discourse/helpers/format-date";
import formatUsername from "discourse/helpers/format-username";
import routeAction from "discourse/helpers/route-action";
@@ -123,7 +123,7 @@ export default class PostVotingComment extends Component {
</div>
<div class="post-voting-comment-post">
- <span class="post-voting-comment-cooked">{{htmlSafe
+ <span class="post-voting-comment-cooked">{{trustHTML
@comment.cooked
}}</span>
diff --git a/plugins/discourse-presence/assets/javascripts/discourse/connectors/topic-above-footer-buttons/presence.gjs b/plugins/discourse-presence/assets/javascripts/discourse/connectors/topic-above-footer-buttons/presence.gjs
index c12c0831bfb..9e918b7ef54 100644
--- a/plugins/discourse-presence/assets/javascripts/discourse/connectors/topic-above-footer-buttons/presence.gjs
+++ b/plugins/discourse-presence/assets/javascripts/discourse/connectors/topic-above-footer-buttons/presence.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { translateSize } from "discourse/lib/avatar-utils";
import TopicPresenceDisplay from "discourse/plugins/discourse-presence/discourse/components/topic-presence-display";
@@ -13,7 +13,7 @@ export default class Presence extends Component {
<template>
<div
- style={{htmlSafe
+ style={{trustHTML
(concat "--avatar-min-height: " this.avatarDimensions "px")
}}
class="topic-above-footer-buttons-outlet presence"
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-posts.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-posts.gjs
index 7fb18903ba8..043e8d25c68 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-posts.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-posts.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
import getURL from "discourse/lib/get-url";
@@ -35,7 +35,7 @@ export default class BestPosts extends Component {
<span class="best-posts --rank"></span>
<span class="best-posts --rank"></span>
<div class="best-posts__post">
- <p>{{htmlSafe post.excerpt}}</p>
+ <p>{{trustHTML post.excerpt}}</p>
</div>
<div class="best-posts__metadata">
<span class="best-posts__likes">
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-topics.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-topics.gjs
index fed3649c9b2..8880610597f 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-topics.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-topics.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import replaceEmoji from "discourse/helpers/replace-emoji";
import getURL from "discourse/lib/get-url";
@@ -41,7 +41,7 @@ export default class BestTopics extends Component {
topic.title
}}</h2>
<span class="best-topics__excerpt">
- {{replaceEmoji (htmlSafe topic.excerpt)}}
+ {{replaceEmoji (trustHTML topic.excerpt)}}
</span>
<div class="best-topics__metadata">
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs
index 19b33124e04..ffe5fc09aa3 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import avatar from "discourse/helpers/avatar";
import number from "discourse/helpers/number";
import getURL from "discourse/lib/get-url";
@@ -15,7 +15,7 @@ const BotMessage = <template>
</div>
{{#if @message}}
<div class="chat-message__text">
- {{htmlSafe @message}}
+ {{trustHTML @message}}
</div>
{{/if}}
{{yield}}
@@ -111,7 +111,7 @@ export default class ChatUsage extends Component {
<div class="chat-window__messages">
<div class="chat-message --left">
- <BotMessage @message={{htmlSafe this.message1Text}} />
+ <BotMessage @message={{trustHTML this.message1Text}} />
</div>
<div class="chat-message --right">
@@ -123,7 +123,7 @@ export default class ChatUsage extends Component {
</div>
<div class="chat-message --left">
- <BotMessage @message={{htmlSafe this.message2Text}} />
+ <BotMessage @message={{trustHTML this.message2Text}} />
</div>
<div class="chat-message --right">
@@ -135,7 +135,7 @@ export default class ChatUsage extends Component {
</div>
<div class="chat-message --left">
- <BotMessage @message={{htmlSafe this.message3Text}} />
+ <BotMessage @message={{trustHTML this.message3Text}} />
</div>
<div class="chat-message --right">
@@ -147,7 +147,7 @@ export default class ChatUsage extends Component {
</div>
<div class="chat-message --left">
- <BotMessage @message={{htmlSafe this.message4Text}} />
+ <BotMessage @message={{trustHTML this.message4Text}} />
</div>
{{#if this.favoriteChannels.length}}
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reactions.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reactions.gjs
index 6f54a3efe80..32101f608b0 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reactions.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reactions.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { concat, get } from "@ember/helper";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import replaceEmoji from "discourse/helpers/replace-emoji";
import { i18n } from "discourse-i18n";
@@ -33,7 +33,7 @@ export default class Reactions extends Component {
@action
computePercentageStyle(count) {
- return htmlSafe(`width: ${this.computePercentage(count)}`);
+ return trustHTML(`width: ${this.computePercentage(count)}`);
}
<template>
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reading-time.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reading-time.gjs
index daf689cf9f5..7761a1eb3bb 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reading-time.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reading-time.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import getURL from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
@@ -40,7 +40,7 @@ export default class ReadingTime extends Component {
</h2>
<div class="rewind-card">
<p class="reading-time__text">
- {{htmlSafe this.bookComparisonText}}
+ {{trustHTML this.bookComparisonText}}
</p>
<div class="reading-time__book">
<div class="book">
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/time-of-day-activity.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/time-of-day-activity.gjs
index a280cd01b32..ac313c6af54 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/time-of-day-activity.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/time-of-day-activity.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import { i18n } from "discourse-i18n";
import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
@@ -138,7 +138,7 @@ export default class TimeOfDayActivity extends Component {
get gridLines() {
return Array.from({ length: 5 }, (_, i) => ({
y: this.SVG_PADDING + (i * (this.SVG_HEIGHT - 2 * this.SVG_PADDING)) / 4,
- style: htmlSafe(`opacity: ${i === 0 || i === 4 ? 0.3 : 0.15}`),
+ style: trustHTML(`opacity: ${i === 0 || i === 4 ? 0.3 : 0.15}`),
}));
}
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/top-words/word-card.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/top-words/word-card.gjs
index 198e46252a7..82fe3bbe500 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/top-words/word-card.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/top-words/word-card.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import emoji from "discourse/helpers/emoji";
import discourseLater from "discourse/lib/later";
@@ -51,7 +51,7 @@ export default class WordCard extends Component {
}
get cardStyle() {
- return htmlSafe(`${this.randomStyle}; ${this.mysteryData.color};`);
+ return trustHTML(`${this.randomStyle}; ${this.mysteryData.color};`);
}
@action
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/rewind.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/rewind.gjs
index cf05542d2d7..ea4430e8fd1 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/rewind.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/rewind.gjs
@@ -5,7 +5,7 @@ import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DToggleSwitch from "discourse/components/d-toggle-switch";
import concatClass from "discourse/helpers/concat-class";
@@ -356,7 +356,7 @@ export default class Rewind extends Component {
{{willDestroy this.cleanup}}
>
{{#unless (eq this.currentUser.id @user.id)}}
- <p class="rewind-other-user">{{htmlSafe
+ <p class="rewind-other-user">{{trustHTML
(i18n
"discourse_rewind.viewing_other_user"
@@ -380,7 +380,7 @@ export default class Rewind extends Component {
<span class="rewind-gibberish__code-line">>> flux conduit
handshake TIMED OUT</span><br /></p>
</div>
- {{htmlSafe (i18n "discourse_rewind.cannot_view_rewind")}}
+ {{trustHTML (i18n "discourse_rewind.cannot_view_rewind")}}
</div>
{{/if}}
diff --git a/plugins/discourse-solved/assets/javascripts/discourse/components/solved-accepted-answer.gjs b/plugins/discourse-solved/assets/javascripts/discourse/components/solved-accepted-answer.gjs
index 6b5851fa97e..c2162290841 100644
--- a/plugins/discourse-solved/assets/javascripts/discourse/components/solved-accepted-answer.gjs
+++ b/plugins/discourse-solved/assets/javascripts/discourse/components/solved-accepted-answer.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import InterpolatedTranslation from "discourse/components/interpolated-translation";
import PostCookedHtml from "discourse/components/post/cooked-html";
@@ -38,7 +38,7 @@ export default class SolvedAcceptedAnswer extends Component {
return "";
}
- return htmlSafe(this.acceptedAnswer.excerpt);
+ return trustHTML(this.acceptedAnswer.excerpt);
}
get showMarkedBy() {
diff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/components/campaign-banner.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/components/campaign-banner.gjs
index 71a3fa49559..0f68bc9c904 100644
--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/components/campaign-banner.gjs
+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/components/campaign-banner.gjs
@@ -6,7 +6,7 @@ import { equal } from "@ember/object/computed";
import { LinkTo } from "@ember/routing";
import { later } from "@ember/runloop";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { observes } from "@ember-decorators/object";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
@@ -230,7 +230,7 @@ export default class CampaignBanner extends Component {
{{#if this.shouldShow}}
<div
class="campaign-banner"
- style={{htmlSafe
+ style={{trustHTML
(concat "box-shadow: 5px 5px #" this.dropShadowColor)
}}
>
@@ -238,7 +238,7 @@ export default class CampaignBanner extends Component {
<div
class="campaign-banner-info"
- style={{htmlSafe this.bannerInfoStyle}}
+ style={{trustHTML this.bannerInfoStyle}}
>
{{#if this.isGoalMet}}
<h2 class="campaign-banner-info-header">
@@ -292,7 +292,7 @@ export default class CampaignBanner extends Component {
{{#if this.subscriberGoal}}
<p class="campaign-banner-progress-description">
- {{htmlSafe
+ {{trustHTML
(i18n
"discourse_subscriptions.campaign.goal_comparison"
current=this.subscribers
@@ -303,7 +303,7 @@ export default class CampaignBanner extends Component {
</p>
{{else}}
<p class="campaign-banner-progress-description">
- {{htmlSafe
+ {{trustHTML
(i18n
"discourse_subscriptions.campaign.goal_comparison"
current=(formatCurrency this.currency this.amountRaised)
@@ -351,7 +351,7 @@ export default class CampaignBanner extends Component {
></progress>
<p class="campaign-banner-progress-description">
- {{htmlSafe
+ {{trustHTML
(i18n
"discourse_subscriptions.campaign.goal_comparison"
current=this.subscribers
@@ -368,7 +368,7 @@ export default class CampaignBanner extends Component {
></progress>
<p class="campaign-banner-progress-description">
- {{htmlSafe
+ {{trustHTML
(i18n
"discourse_subscriptions.campaign.goal_comparison"
current=(formatCurrency this.currency this.amountRaised)
diff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/components/product-item.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/components/product-item.gjs
index 53dc38e5ef2..c786454c9b5 100644
--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/components/product-item.gjs
+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/components/product-item.gjs
@@ -1,7 +1,7 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { i18n } from "discourse-i18n";
@@ -12,7 +12,7 @@ export default class ProductItem extends Component {
<h2>{{this.product.name}}</h2>
<p class="product-description">
- {{htmlSafe this.product.description}}
+ {{trustHTML this.product.description}}
</p>
{{#if this.isLoggedIn}}
diff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions.js b/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions.js
index 0349727a1a4..f9769ae35cf 100644
--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions.js
+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/admin-plugins/discourse-subscriptions.js
@@ -1,7 +1,7 @@
import Controller from "@ember/controller";
import { action, computed } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { i18n } from "discourse-i18n";
@@ -39,7 +39,7 @@ export default class AdminPluginsDiscourseSubscriptionsController extends Contro
createOneClickCampaign() {
this.dialog.yesNoConfirm({
title: i18n("discourse_subscriptions.campaign.confirm_creation_title"),
- message: htmlSafe(
+ message: trustHTML(
i18n("discourse_subscriptions.campaign.confirm_creation")
),
didConfirm: () => {
diff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/subscriptions.js b/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/subscriptions.js
index b707a08ab33..51e0dfa9890 100644
--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/subscriptions.js
+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/controllers/subscriptions.js
@@ -1,6 +1,6 @@
import Controller from "@ember/controller";
import { computed } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { i18n } from "discourse-i18n";
export default class SubscriptionsController extends Controller {
@@ -28,12 +28,12 @@ export default class SubscriptionsController extends Controller {
}
if (this.currentUser) {
- return htmlSafe(`<stripe-pricing-table
+ return trustHTML(`<stripe-pricing-table
pricing-table-id="${pricingTableId}"
publishable-key="${publishableKey}"
customer-email="${this.email}"></stripe-pricing-table>`);
} else {
- return htmlSafe(`<stripe-pricing-table
+ return trustHTML(`<stripe-pricing-table
pricing-table-id="${pricingTableId}"
publishable-key="${publishableKey}"
></stripe-pricing-table>`);
diff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/helpers/format-unix-date.js b/plugins/discourse-subscriptions/assets/javascripts/discourse/helpers/format-unix-date.js
index 3a1b786f0d5..febe850adb9 100644
--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/helpers/format-unix-date.js
+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/helpers/format-unix-date.js
@@ -1,11 +1,11 @@
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
export default function formatUnixDate(timestamp) {
if (timestamp) {
const date = new Date(moment.unix(timestamp).format());
- return new htmlSafe(
+ return new trustHTML(
autoUpdatingRelativeAge(date, {
format: "medium",
title: true,
diff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/dashboard.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/dashboard.gjs
index 43dbde63431..bbed2fdc395 100644
--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/dashboard.gjs
+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/admin-plugins/discourse-subscriptions/dashboard.gjs
@@ -1,7 +1,7 @@
import { array, fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import LoadMore from "discourse/components/load-more";
import formatDuration from "discourse/helpers/format-duration";
import { i18n } from "discourse-i18n";
@@ -64,11 +64,11 @@ export default <template>
@route="patrons.show"
@model={{payment.payment_intent_id}}
>
- {{htmlSafe payment.payment_intent_id}}
+ {{trustHTML payment.payment_intent_id}}
</LinkTo>
</td>
<td>{{payment.receipt_email}}</td>
- <td>{{htmlSafe (formatDuration payment.created_at_age)}}</td>
+ <td>{{trustHTML (formatDuration payment.created_at_age)}}</td>
<td class="amount">{{payment.amount_currency}}</td>
</tr>
{{/each}}
diff --git a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/subscribe/show.gjs b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/subscribe/show.gjs
index ef2d1e4949b..0b7771f2558 100644
--- a/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/subscribe/show.gjs
+++ b/plugins/discourse-subscriptions/assets/javascripts/discourse/templates/subscribe/show.gjs
@@ -1,6 +1,6 @@
import { Input } from "@ember/component";
import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import loadingSpinner from "discourse/helpers/loading-spinner";
import { i18n } from "discourse-i18n";
@@ -21,7 +21,7 @@ export default <template>
<hr />
<p>
- {{htmlSafe @controller.model.product.description}}
+ {{trustHTML @controller.model.product.description}}
</p>
</div>
diff --git a/plugins/footnote/assets/javascripts/api-initializers/inline-footnotes.gjs b/plugins/footnote/assets/javascripts/api-initializers/inline-footnotes.gjs
index d6bc90fa943..c471e9bcba7 100644
--- a/plugins/footnote/assets/javascripts/api-initializers/inline-footnotes.gjs
+++ b/plugins/footnote/assets/javascripts/api-initializers/inline-footnotes.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DTooltip from "discourse/float-kit/components/d-tooltip";
import { apiInitializer } from "discourse/lib/api";
@@ -30,7 +30,7 @@ class InlineFootnote extends Component {
></a>
</:trigger>
<:content>
- {{htmlSafe @data.footnoteContent}}
+ {{trustHTML @data.footnoteContent}}
</:content>
</DTooltip>
</template>
diff --git a/plugins/poll/assets/javascripts/discourse/components/modal/poll-breakdown.gjs b/plugins/poll/assets/javascripts/discourse/components/modal/poll-breakdown.gjs
index 1c601d1910e..6b83009ba54 100644
--- a/plugins/poll/assets/javascripts/discourse/components/modal/poll-breakdown.gjs
+++ b/plugins/poll/assets/javascripts/discourse/components/modal/poll-breakdown.gjs
@@ -5,7 +5,7 @@ import { on } from "@ember/modifier";
import { action, computed } from "@ember/object";
import { service } from "@ember/service";
import { classify } from "@ember/string";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import DModal from "discourse/components/d-modal";
import concatClass from "discourse/helpers/concat-class";
@@ -39,7 +39,7 @@ export default class PollBreakdownModal extends Component {
@computed("model.poll.title", "model.post.topic.title")
get title() {
return this.model?.poll?.title
- ? htmlSafe(this.model?.poll?.title)
+ ? trustHTML(this.model?.poll?.title)
: this.model?.post?.topic?.title;
}
diff --git a/plugins/poll/assets/javascripts/discourse/components/poll-breakdown-chart.gjs b/plugins/poll/assets/javascripts/discourse/components/poll-breakdown-chart.gjs
index 118a610041d..b11083167a9 100644
--- a/plugins/poll/assets/javascripts/discourse/components/poll-breakdown-chart.gjs
+++ b/plugins/poll/assets/javascripts/discourse/components/poll-breakdown-chart.gjs
@@ -3,7 +3,7 @@ import Component from "@ember/component";
import { computed } from "@ember/object";
import { mapBy } from "@ember/object/computed";
import { next } from "@ember/runloop";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { classNames } from "@ember-decorators/component";
import loadChartJS, {
loadChartJSDatalabels,
@@ -66,7 +66,7 @@ export default class PollBreakdownChart extends Component {
@computed("optionColors", "index")
get colorStyle() {
- return htmlSafe(`background: ${this.optionColors[this.index]};`);
+ return trustHTML(`background: ${this.optionColors[this.index]};`);
}
@computed("data", "displayMode")
diff --git a/plugins/poll/assets/javascripts/discourse/components/poll-breakdown-option.gjs b/plugins/poll/assets/javascripts/discourse/components/poll-breakdown-option.gjs
index af7a35f2e68..e14e7643ddb 100644
--- a/plugins/poll/assets/javascripts/discourse/components/poll-breakdown-option.gjs
+++ b/plugins/poll/assets/javascripts/discourse/components/poll-breakdown-option.gjs
@@ -3,7 +3,7 @@ import Component from "@ember/component";
import { on } from "@ember/modifier";
import { computed } from "@ember/object";
import { equal } from "@ember/object/computed";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { propertyEqual } from "discourse/lib/computed";
import loadChartJS from "discourse/lib/load-chart-js";
@@ -50,7 +50,7 @@ export default class PollBreakdownOption extends Component {
get colorBackgroundStyle() {
if (this.highlighted) {
// TODO: Use CSS variables (#10341)
- return htmlSafe("background: rgba(0, 0, 0, 0.1);");
+ return trustHTML("background: rgba(0, 0, 0, 0.1);");
}
}
@@ -60,7 +60,7 @@ export default class PollBreakdownOption extends Component {
? this.Chart?.helpers.getHoverColor(this.optionColors[this.index])
: this.optionColors[this.index];
- return htmlSafe(`background: ${color};`);
+ return trustHTML(`background: ${color};`);
}
<template>
diff --git a/plugins/poll/assets/javascripts/discourse/components/poll-info.gjs b/plugins/poll/assets/javascripts/discourse/components/poll-info.gjs
index 5ec48bd67ce..4b85d28592b 100644
--- a/plugins/poll/assets/javascripts/discourse/components/poll-info.gjs
+++ b/plugins/poll/assets/javascripts/discourse/components/poll-info.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import icon from "discourse/helpers/d-icon";
import { relativeAge } from "discourse/lib/formatter";
import { i18n } from "discourse-i18n";
@@ -18,12 +18,12 @@ export default class PollInfoComponent extends Component {
if (max > 0) {
if (min === max && min > 1) {
- return htmlSafe(i18n("poll.multiple.help.x_options", { count: min }));
+ return trustHTML(i18n("poll.multiple.help.x_options", { count: min }));
}
if (min > 1) {
if (max < optionsCount) {
- return htmlSafe(
+ return trustHTML(
i18n("poll.multiple.help.between_min_and_max_options", {
min,
max,
@@ -31,13 +31,13 @@ export default class PollInfoComponent extends Component {
);
}
- return htmlSafe(
+ return trustHTML(
i18n("poll.multiple.help.at_least_min_options", { count: min })
);
}
if (max <= optionsCount) {
- return htmlSafe(
+ return trustHTML(
i18n("poll.multiple.help.up_to_max_options", { count: max })
);
}
@@ -110,7 +110,7 @@ export default class PollInfoComponent extends Component {
}
get resultsOnVoteTitle() {
- return htmlSafe(i18n("poll.results.vote.title"));
+ return trustHTML(i18n("poll.results.vote.title"));
}
get resultsOnClose() {
@@ -118,7 +118,7 @@ export default class PollInfoComponent extends Component {
}
get resultsOnCloseTitle() {
- return htmlSafe(i18n("poll.results.closed.title"));
+ return trustHTML(i18n("poll.results.closed.title"));
}
get resultsStaffOnly() {
@@ -129,7 +129,7 @@ export default class PollInfoComponent extends Component {
}
get resultsStaffOnlyTitle() {
- return htmlSafe(i18n("poll.results.staff.title"));
+ return trustHTML(i18n("poll.results.staff.title"));
}
get publicTitle() {
@@ -142,7 +142,7 @@ export default class PollInfoComponent extends Component {
}
get publicTitleLabel() {
- return htmlSafe(i18n("poll.public.title"));
+ return trustHTML(i18n("poll.public.title"));
}
get showInstructionsSection() {
diff --git a/plugins/poll/assets/javascripts/discourse/components/poll-results-pie.gjs b/plugins/poll/assets/javascripts/discourse/components/poll-results-pie.gjs
index 626f6f1d4b8..09f828371a8 100644
--- a/plugins/poll/assets/javascripts/discourse/components/poll-results-pie.gjs
+++ b/plugins/poll/assets/javascripts/discourse/components/poll-results-pie.gjs
@@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { modifier } from "ember-modifier";
import {
applyHtmlDecorators,
@@ -111,11 +111,11 @@ export default class PollResultsPieComponent extends Component {
});
get canvasId() {
- return htmlSafe(`poll-results-chart-${this.args.id}`);
+ return trustHTML(`poll-results-chart-${this.args.id}`);
}
get legendId() {
- return htmlSafe(`poll-results-legend-${this.args.id}`);
+ return trustHTML(`poll-results-legend-${this.args.id}`);
}
@action
diff --git a/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs b/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs
index afa082c62cc..c266faba8d8 100644
--- a/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs
+++ b/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs
@@ -1,12 +1,12 @@
import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { i18n } from "discourse-i18n";
import decorateCookedContent from "../modifiers/decorate-cooked-content";
import decoratePollOption from "../modifiers/decorate-poll-option";
export default class PollResultsRankedChoiceComponent extends Component {
get rankedChoiceWinnerText() {
- return htmlSafe(
+ return trustHTML(
i18n("poll.ranked_choice.winner", {
count: this.args.rankedChoiceOutcome?.round_activity?.length,
winner: this.args.rankedChoiceOutcome?.winning_candidate?.html,
diff --git a/plugins/poll/assets/javascripts/discourse/components/poll-results-standard.gjs b/plugins/poll/assets/javascripts/discourse/components/poll-results-standard.gjs
index cfcd551e0ac..7d4e40b893c 100644
--- a/plugins/poll/assets/javascripts/discourse/components/poll-results-standard.gjs
+++ b/plugins/poll/assets/javascripts/discourse/components/poll-results-standard.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { concat } from "@ember/helper";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { i18n } from "discourse-i18n";
import evenRound from "discourse/plugins/poll/lib/even-round";
import decoratePollOption from "../modifiers/decorate-poll-option";
@@ -102,7 +102,7 @@ export default class PollResultsStandardComponent extends Component {
<div class="bar-back">
<div
class="bar"
- style={{htmlSafe (concat "width:" option.percentage "%")}}
+ style={{trustHTML (concat "width:" option.percentage "%")}}
/>
</div>
{{/unless}}
diff --git a/plugins/poll/assets/javascripts/discourse/components/poll.gjs b/plugins/poll/assets/javascripts/discourse/components/poll.gjs
index e46ef15fb2d..09a7a0f3585 100644
--- a/plugins/poll/assets/javascripts/discourse/components/poll.gjs
+++ b/plugins/poll/assets/javascripts/discourse/components/poll.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { TrackedObject } from "@ember-compat/tracked-built-ins";
import icon from "discourse/helpers/d-icon";
import { ajax } from "discourse/lib/ajax";
@@ -172,7 +172,7 @@ export default class PollComponent extends Component {
}
get titleHTML() {
- return htmlSafe(this.args.titleHTML);
+ return trustHTML(this.args.titleHTML);
}
get topicArchived() {
@@ -452,7 +452,7 @@ export default class PollComponent extends Component {
const average = this.voters === 0 ? 0 : round(totalScore / this.voters, -2);
- return htmlSafe(i18n("poll.average_rating", { average }));
+ return trustHTML(i18n("poll.average_rating", { average }));
}
get availableDisplayMode() {
diff --git a/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/menus.gjs b/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/menus.gjs
index 6ed89372aa1..6e5d926fd70 100644
--- a/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/menus.gjs
+++ b/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/menus.gjs
@@ -4,7 +4,7 @@ import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DToggleSwitch from "discourse/components/d-toggle-switch";
import DMenu from "discourse/float-kit/components/d-menu";
@@ -28,14 +28,14 @@ export default class Menus extends Component {
@tracked maxWidth = MENU.options.maxWidth;
@tracked identifier;
@tracked offset = MENU.options.offset;
- @tracked _content = htmlSafe("<ul><li>Hello</li><li>World!</li></ul>");
+ @tracked _content = trustHTML("<ul><li>Hello</li><li>World!</li></ul>");
get content() {
return this._content;
}
set content(value) {
- this._content = htmlSafe(value);
+ this._content = trustHTML(value);
}
get templateCode() {
diff --git a/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/tooltips.gjs b/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/tooltips.gjs
index 1a20ef2f7c4..79726e78010 100644
--- a/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/tooltips.gjs
+++ b/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/tooltips.gjs
@@ -4,7 +4,7 @@ import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import DToggleSwitch from "discourse/components/d-toggle-switch";
import DTooltip from "discourse/float-kit/components/d-tooltip";
@@ -40,7 +40,7 @@ export default class Tooltips extends Component {
}
set content(value) {
- this._content = htmlSafe(value);
+ this._content = trustHTML(value);
}
@action
diff --git a/themes/horizon/javascripts/discourse/components/experimental-screen.gjs b/themes/horizon/javascripts/discourse/components/experimental-screen.gjs
index 2a76826eba0..f4458834c0d 100644
--- a/themes/horizon/javascripts/discourse/components/experimental-screen.gjs
+++ b/themes/horizon/javascripts/discourse/components/experimental-screen.gjs
@@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import { bind } from "discourse/lib/decorators";
const DO_NOT_RENDER_LIST = ["login"];
@@ -28,7 +28,7 @@ export default class ExperimentalScreen extends Component {
}
get distanceStyles() {
- return htmlSafe(
+ return trustHTML(
`--left-distance: ${this.left}px; --right-distance: ${this.right}px;`
);
}
diff --git a/themes/horizon/javascripts/discourse/components/user-color-palette-menu-item.gjs b/themes/horizon/javascripts/discourse/components/user-color-palette-menu-item.gjs
index d8427b1d74c..63e3112f2cd 100644
--- a/themes/horizon/javascripts/discourse/components/user-color-palette-menu-item.gjs
+++ b/themes/horizon/javascripts/discourse/components/user-color-palette-menu-item.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
-import { htmlSafe } from "@ember/template";
+import { trustHTML } from "@ember/template";
import DButton from "discourse/components/d-button";
import concatClass from "discourse/helpers/concat-class";
@@ -30,7 +30,7 @@ export default class UserColorPaletteMenuItem extends Component {
"btn-flat user-color-palette-menu__item-choice"
this.activeClass
}}
- style={{htmlSafe this.siteStyle}}
+ style={{trustHTML this.siteStyle}}
@icon="circle"
@translatedLabel={{@colorPalette.name}}
@action={{this.paletteSelected}}