Fix bug with RTL support and deprecation of Discourse.SiteSettings

This commit is contained in:
Penar Musaraj 2020-08-04 12:47:52 -04:00
parent c9dd9cf435
commit 94063e360f
No known key found for this signature in database
GPG Key ID: E390435D881FF0F7
1 changed files with 5 additions and 5 deletions

View File

@ -1,8 +1,8 @@
import { withPluginApi } from "discourse/lib/plugin-api"; import { withPluginApi } from "discourse/lib/plugin-api";
import Category from "discourse/models/category"; import Category from "discourse/models/category";
import { helperContext } from "discourse-common/lib/helpers";
import { iconHTML, iconNode } from "discourse-common/lib/icon-library"; import { iconHTML, iconNode } from "discourse-common/lib/icon-library";
import isRTL from "discourse/lib/text-direction"; import { isRTL } from "discourse/lib/text-direction";
import { h } from "virtual-dom"; import { h } from "virtual-dom";
import getURL from "discourse-common/lib/get-url"; import getURL from "discourse-common/lib/get-url";
@ -41,6 +41,7 @@ export default {
} }
function categoryIconsRenderer(category, opts) { function categoryIconsRenderer(category, opts) {
let siteSettings = helperContext().siteSettings;
let description = get(category, "description_text"); let description = get(category, "description_text");
let restricted = get(category, "read_restricted"); let restricted = get(category, "read_restricted");
let url = opts.url let url = opts.url
@ -59,8 +60,7 @@ export default {
parentCat = Category.findById(get(category, "parent_category_id")); parentCat = Category.findById(get(category, "parent_category_id"));
} }
const categoryStyle = const categoryStyle = opts.categoryStyle || siteSettings.category_style;
opts.categoryStyle || Discourse.SiteSettings.category_style;
if (categoryStyle !== "none") { if (categoryStyle !== "none") {
if (parentCat && parentCat !== category) { if (parentCat && parentCat !== category) {
html += categoryStripe( html += categoryStripe(
@ -102,7 +102,7 @@ export default {
let categoryName = escapeExpression(get(category, "name")); let categoryName = escapeExpression(get(category, "name"));
if (Discourse.SiteSettings.support_mixed_text_direction) { if (siteSettings.support_mixed_text_direction) {
categoryDir = isRTL(categoryName) ? 'dir="rtl"' : 'dir="ltr"'; categoryDir = isRTL(categoryName) ? 'dir="rtl"' : 'dir="ltr"';
} }