mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 12:43:54 -06:00
DEV: Remove 'htmlSafe' string prototype extensions (#16828)
Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions
This commit is contained in:
parent
85ceafb4dc
commit
4e622c9fd8
@ -10,6 +10,7 @@ import deprecated from "discourse-common/lib/deprecated";
|
|||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import { getOwner } from "discourse-common/lib/get-owner";
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
|
import { htmlSafe } from "@ember/template";
|
||||||
|
|
||||||
const Site = RestModel.extend({
|
const Site = RestModel.extend({
|
||||||
isReadOnly: alias("is_readonly"),
|
isReadOnly: alias("is_readonly"),
|
||||||
@ -48,7 +49,7 @@ const Site = RestModel.extend({
|
|||||||
if (!isEmpty(siteFields)) {
|
if (!isEmpty(siteFields)) {
|
||||||
return siteFields.map((f) => {
|
return siteFields.map((f) => {
|
||||||
let value = fields ? fields[f.id.toString()] : null;
|
let value = fields ? fields[f.id.toString()] : null;
|
||||||
value = value || "—".htmlSafe();
|
value = value || htmlSafe("—");
|
||||||
return { name: f.name, value };
|
return { name: f.name, value };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import { isEmpty } from "@ember/utils";
|
|||||||
import { longDate } from "discourse/lib/formatter";
|
import { longDate } from "discourse/lib/formatter";
|
||||||
import { url } from "discourse/lib/computed";
|
import { url } from "discourse/lib/computed";
|
||||||
import { userPath } from "discourse/lib/url";
|
import { userPath } from "discourse/lib/url";
|
||||||
|
import { htmlSafe } from "@ember/template";
|
||||||
|
|
||||||
export const SECOND_FACTOR_METHODS = {
|
export const SECOND_FACTOR_METHODS = {
|
||||||
TOTP: 1,
|
TOTP: 1,
|
||||||
@ -176,9 +177,9 @@ const User = RestModel.extend({
|
|||||||
@discourseComputed("profile_background_upload_url")
|
@discourseComputed("profile_background_upload_url")
|
||||||
profileBackgroundUrl(bgUrl) {
|
profileBackgroundUrl(bgUrl) {
|
||||||
if (isEmpty(bgUrl) || !this.siteSettings.allow_profile_backgrounds) {
|
if (isEmpty(bgUrl) || !this.siteSettings.allow_profile_backgrounds) {
|
||||||
return "".htmlSafe();
|
return htmlSafe("");
|
||||||
}
|
}
|
||||||
return ("background-image: url(" + getURLWithCDN(bgUrl) + ")").htmlSafe();
|
return htmlSafe("background-image: url(" + getURLWithCDN(bgUrl) + ")");
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed()
|
@discourseComputed()
|
||||||
|
@ -5,6 +5,7 @@ import { findOrResetCachedTopicList } from "discourse/lib/cached-topic-list";
|
|||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
|
import { htmlSafe } from "@ember/template";
|
||||||
|
|
||||||
export const NEW_FILTER = "new";
|
export const NEW_FILTER = "new";
|
||||||
export const UNREAD_FILTER = "unread";
|
export const UNREAD_FILTER = "unread";
|
||||||
@ -85,10 +86,12 @@ export default (inboxType, path, filter) => {
|
|||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const title = I18n.t("user.no_messages_title");
|
const title = I18n.t("user.no_messages_title");
|
||||||
const body = I18n.t("user.no_messages_body", {
|
const body = htmlSafe(
|
||||||
aboutUrl: getURL("/about"),
|
I18n.t("user.no_messages_body", {
|
||||||
icon: iconHTML("envelope"),
|
aboutUrl: getURL("/about"),
|
||||||
}).htmlSafe();
|
icon: iconHTML("envelope"),
|
||||||
|
})
|
||||||
|
);
|
||||||
return { title, body };
|
return { title, body };
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2,18 +2,21 @@ import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
|||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import { htmlSafe } from "@ember/template";
|
||||||
|
|
||||||
export default UserActivityStreamRoute.extend({
|
export default UserActivityStreamRoute.extend({
|
||||||
userActionType: null,
|
userActionType: null,
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const title = I18n.t("user_activity.no_activity_title");
|
const title = I18n.t("user_activity.no_activity_title");
|
||||||
const body = I18n.t("user_activity.no_activity_body", {
|
const body = htmlSafe(
|
||||||
topUrl: getURL("/top"),
|
I18n.t("user_activity.no_activity_body", {
|
||||||
categoriesUrl: getURL("/categories"),
|
topUrl: getURL("/top"),
|
||||||
preferencesUrl: getURL("/my/preferences"),
|
categoriesUrl: getURL("/categories"),
|
||||||
heartIcon: iconHTML("heart"),
|
preferencesUrl: getURL("/my/preferences"),
|
||||||
}).htmlSafe();
|
heartIcon: iconHTML("heart"),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
return { title, body };
|
return { title, body };
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user