mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Use the category's text-only description in the category-chooser (#15735)
The category description is derived from a topic's cooked text and contains HTML elements. When we display it inside the category chooser in places like the composer, we don't want these elements to alter the component in any way. Context: https://meta.discourse.org/t/some-html-tags-not-stripped-from-category-description/215017
This commit is contained in:
@@ -35,8 +35,6 @@ export default SelectKitRowComponent.extend({
|
||||
}),
|
||||
categoryName: reads("category.name"),
|
||||
|
||||
categoryDescription: reads("category.description"),
|
||||
|
||||
categoryDescriptionText: reads("category.description_text"),
|
||||
|
||||
category: computed("rowValue", "rowName", function () {
|
||||
@@ -94,12 +92,12 @@ export default SelectKitRowComponent.extend({
|
||||
|
||||
shouldDisplayDescription: computed(
|
||||
"displayCategoryDescription",
|
||||
"categoryDescription",
|
||||
"categoryDescriptionText",
|
||||
function () {
|
||||
return (
|
||||
this.displayCategoryDescription &&
|
||||
this.categoryDescription &&
|
||||
this.categoryDescription !== "null"
|
||||
this.categoryDescriptionText &&
|
||||
this.categoryDescriptionText !== "null"
|
||||
);
|
||||
}
|
||||
),
|
||||
@@ -110,12 +108,6 @@ export default SelectKitRowComponent.extend({
|
||||
}
|
||||
}),
|
||||
|
||||
description: computed("categoryDescription", function () {
|
||||
if (this.categoryDescription) {
|
||||
return this._formatDescription(this.categoryDescription);
|
||||
}
|
||||
}),
|
||||
|
||||
_formatDescription(description) {
|
||||
const limit = 200;
|
||||
return `${description.substr(0, limit)}${
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
|
||||
{{#if shouldDisplayDescription}}
|
||||
<div class="category-desc" aria-hidden="true">{{dir-span description htmlSafe="true"}}</div>
|
||||
<div class="category-desc" aria-hidden="true">{{dir-span descriptionText htmlSafe="true"}}</div>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{html-safe label}}
|
||||
|
||||
Reference in New Issue
Block a user