FIX: Refactor broke wizard

This commit is contained in:
Robin Ward 2020-08-17 16:33:57 -04:00
parent 2567bb4a67
commit e2e51ee348
3 changed files with 10 additions and 7 deletions

View File

@ -1,12 +1,12 @@
import I18n from "I18n"; import I18n from "I18n";
import { h } from "virtual-dom"; import { h } from "virtual-dom";
import attributeHook from "discourse-common/lib/attribute-hook"; import attributeHook from "discourse-common/lib/attribute-hook";
import Session from "discourse/models/session";
const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
let _renderers = []; let _renderers = [];
let warnMissingIcons = true; let warnMissingIcons = true;
let _iconList;
const REPLACEMENTS = { const REPLACEMENTS = {
"d-tracking": "bell", "d-tracking": "bell",
@ -110,13 +110,14 @@ function iconClasses(icon, params) {
return classNames; return classNames;
} }
export function setIconList(iconList) {
_iconList = iconList;
}
function warnIfMissing(id) { function warnIfMissing(id) {
if (warnMissingIcons) { if (warnMissingIcons && _iconList && _iconList.indexOf(id) === -1) {
let iconList = Session.currentProp("svgIconList");
if (iconList && iconList.indexOf(id) === -1) {
console.warn(`The icon "${id}" is missing from the SVG subset.`); // eslint-disable-line no-console console.warn(`The icon "${id}" is missing from the SVG subset.`); // eslint-disable-line no-console
} }
}
} }
function handleIconId(icon) { function handleIconId(icon) {

View File

@ -10,6 +10,7 @@ import {
} from "discourse-common/config/environment"; } from "discourse-common/config/environment";
import { setupURL, setupS3CDN } from "discourse-common/lib/get-url"; import { setupURL, setupS3CDN } from "discourse-common/lib/get-url";
import deprecated from "discourse-common/lib/deprecated"; import deprecated from "discourse-common/lib/deprecated";
import { setIconList } from "discourse-common/lib/icon-library";
export default { export default {
name: "discourse-bootstrap", name: "discourse-bootstrap",
@ -100,7 +101,7 @@ export default {
Session.currentProp("svgSpritePath", setupData.svgSpritePath); Session.currentProp("svgSpritePath", setupData.svgSpritePath);
if (isDevelopment()) { if (isDevelopment()) {
Session.currentProp("svgIconList", setupData.svgIconList); setIconList(setupData.svgIconList);
} }
if (setupData.s3BaseUrl) { if (setupData.s3BaseUrl) {

View File

@ -2,6 +2,7 @@ import { loadSprites } from "discourse/lib/svg-sprite-loader";
export default { export default {
name: "svg-sprite-fontawesome", name: "svg-sprite-fontawesome",
after: "discourse-bootstrap",
initialize(container) { initialize(container) {
let session = container.lookup("session:main"); let session = container.lookup("session:main");