mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Remove discourse constants (#9958)
* DEV: `Discourse.baseUri` does not exist This never could have worked - should have been `Discourse.BaseUri` if anything. * DEV: Remove Discourse.Environment * DEV: Remove `Discourse.disableMissingIconWarning` * DEV: A bunch more missing environment checks
This commit is contained in:
@@ -1,9 +1,23 @@
|
||||
export const INPUT_DELAY = 250;
|
||||
|
||||
let environment = Ember.testing ? "test" : "development";
|
||||
let environment = "unknown";
|
||||
|
||||
export function isTesting() {
|
||||
return environment === "test";
|
||||
export function setEnvironment(e) {
|
||||
if (isTesting()) {
|
||||
environment = "testing";
|
||||
} else {
|
||||
environment = e;
|
||||
}
|
||||
}
|
||||
|
||||
export default { environment };
|
||||
export function isTesting() {
|
||||
return Ember.testing;
|
||||
}
|
||||
|
||||
export function isDevelopment() {
|
||||
return environment === "development";
|
||||
}
|
||||
|
||||
export function isProduction() {
|
||||
return environment === "production";
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import I18n from "I18n";
|
||||
import { h } from "virtual-dom";
|
||||
import attributeHook from "discourse-common/lib/attribute-hook";
|
||||
import { isDevelopment } from "discourse-common/config/environment";
|
||||
|
||||
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
||||
let _renderers = [];
|
||||
|
||||
let warnMissingIcons = true;
|
||||
|
||||
const REPLACEMENTS = {
|
||||
"d-tracking": "bell",
|
||||
"d-muted": "discourse-bell-slash",
|
||||
@@ -45,6 +48,14 @@ export function replaceIcon(source, destination) {
|
||||
REPLACEMENTS[source] = destination;
|
||||
}
|
||||
|
||||
export function disableMissingIconWarning() {
|
||||
warnMissingIcons = false;
|
||||
}
|
||||
|
||||
export function enableMissingIconWarning() {
|
||||
warnMissingIcons = false;
|
||||
}
|
||||
|
||||
export function renderIcon(renderType, id, params) {
|
||||
for (let i = 0; i < _renderers.length; i++) {
|
||||
let renderer = _renderers[i];
|
||||
@@ -105,8 +116,8 @@ function iconClasses(icon, params) {
|
||||
function warnIfMissing(id) {
|
||||
if (
|
||||
typeof Discourse !== "undefined" &&
|
||||
Discourse.Environment === "development" &&
|
||||
!Discourse.disableMissingIconWarning &&
|
||||
isDevelopment() &&
|
||||
warnMissingIcons &&
|
||||
Discourse.SvgIconList &&
|
||||
Discourse.SvgIconList.indexOf(id) === -1
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user