diff --git a/app/assets/javascripts/discourse/app/helpers/dir-span.js b/app/assets/javascripts/discourse/app/helpers/dir-span.js index 022b2de52f6..83efafb63bb 100644 --- a/app/assets/javascripts/discourse/app/helpers/dir-span.js +++ b/app/assets/javascripts/discourse/app/helpers/dir-span.js @@ -1,6 +1,7 @@ import { helperContext, registerUnbound } from "discourse-common/lib/helpers"; import { htmlSafe } from "@ember/template"; import { isRTL } from "discourse/lib/text-direction"; +import { escapeExpression } from "discourse/lib/utilities"; function setDir(text) { let content = text ? text : ""; @@ -12,6 +13,7 @@ function setDir(text) { return content; } -export default registerUnbound("dir-span", function (str) { - return htmlSafe(setDir(str)); +export default registerUnbound("dir-span", function (str, escapeText = true) { + let text = escapeText ? escapeExpression(str) : str; + return htmlSafe(setDir(text)); }); diff --git a/app/assets/javascripts/discourse/app/models/category.js b/app/assets/javascripts/discourse/app/models/category.js index 2fe8ea5ac1f..940bb5ba39e 100644 --- a/app/assets/javascripts/discourse/app/models/category.js +++ b/app/assets/javascripts/discourse/app/models/category.js @@ -8,7 +8,6 @@ import { ajax } from "discourse/lib/ajax"; import { get } from "@ember/object"; import { getOwner } from "discourse-common/lib/get-owner"; import getURL from "discourse-common/lib/get-url"; -import { escapeExpression } from "discourse/lib/utilities"; const STAFF_GROUP_NAME = "staff"; @@ -57,11 +56,6 @@ const Category = RestModel.extend({ return { type: "category", id, category: this }; }, - @discourseComputed("name") - escapeName(name) { - return escapeExpression(name); - }, - @discourseComputed("parentCategory.ancestors") ancestors(parentAncestors) { return [...(parentAncestors || []), this]; diff --git a/app/assets/javascripts/discourse/app/templates/components/category-title-link.hbs b/app/assets/javascripts/discourse/app/templates/components/category-title-link.hbs index 3f7ad86de31..43cec199dc2 100644 --- a/app/assets/javascripts/discourse/app/templates/components/category-title-link.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/category-title-link.hbs @@ -4,7 +4,7 @@ {{#if category.read_restricted}} {{d-icon lockIcon}} {{/if}} - {{dir-span category.escapeName}} + {{dir-span category.name}} {{#if category.uploaded_logo.url}} {{cdn-img diff --git a/app/assets/javascripts/discourse/app/templates/components/parent-category-row.hbs b/app/assets/javascripts/discourse/app/templates/components/parent-category-row.hbs index dbf5cc2922b..b6145eb7ca9 100644 --- a/app/assets/javascripts/discourse/app/templates/components/parent-category-row.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/parent-category-row.hbs @@ -5,7 +5,7 @@ {{category-title-link category=category}} {{#if category.description_excerpt}}
{{dir-span category.description}}
+{{dir-span category.description false}}
{{/if}} {{/if}} diff --git a/app/assets/javascripts/select-kit/addon/templates/components/category-row.hbs b/app/assets/javascripts/select-kit/addon/templates/components/category-row.hbs index dfd630dffcb..77795727da7 100644 --- a/app/assets/javascripts/select-kit/addon/templates/components/category-row.hbs +++ b/app/assets/javascripts/select-kit/addon/templates/components/category-row.hbs @@ -9,7 +9,7 @@ {{#if shouldDisplayDescription}} - + {{/if}} {{else}} {{html-safe label}}