Skip to content

A platform for community discussion. Free, open, simple.

DEV: Log deprecated FA 4.7 icon names in /logs

Penar Musaraj2dd9727c118f
diff --git a/app/assets/javascripts/discourse-common/lib/icon-library.js.es6 b/app/assets/javascripts/discourse-common/lib/icon-library.js.es6
index f0188fb2c5e..0125e96548a 100644
--- a/app/assets/javascripts/discourse-common/lib/icon-library.js.es6
+++ b/app/assets/javascripts/discourse-common/lib/icon-library.js.es6
@@ -1,4 +1,5 @@
import { h } from "virtual-dom";
+import { reportToLogster } from "discourse/lib/utilities";
import attributeHook from "discourse-common/lib/attribute-hook";
import deprecated from "discourse-common/lib/deprecated";
@@ -584,6 +585,11 @@ function warnIfDeprecated(oldId, newId) {
deprecated(
`Please replace all occurrences of "${oldId}"" with "${newId}". FontAwesome 4.7 icon names are now deprecated and will be removed in the next release.`
);
+ const errorData = {
+ message: `FA icon deprecation: replace "${oldId}"" with "${newId}".`,
+ stacktrace: Error().stack
+ };
+ reportToLogster(errorData);
}
function handleIconId(icon) {
diff --git a/app/assets/javascripts/discourse/lib/utilities.js.es6 b/app/assets/javascripts/discourse/lib/utilities.js.es6
index ff43ee32a18..9fd061cddb7 100644
--- a/app/assets/javascripts/discourse/lib/utilities.js.es6
+++ b/app/assets/javascripts/discourse/lib/utilities.js.es6
@@ -376,12 +376,7 @@ export function postRNWebviewMessage(prop, value) {
}
}
-function reportToLogster(name, error) {
- const data = {
- message: `${name} theme/component is throwing errors`,
- stacktrace: error.stack
- };
-
+export function reportToLogster(data) {
Ember.$.ajax(`${Discourse.BaseUri}/logs/report_js_error`, {
data,
type: "POST",
@@ -392,7 +387,11 @@ function reportToLogster(name, error) {
export function rescueThemeError(name, error, api) {
/* eslint-disable-next-line no-console */
console.error(`"${name}" error:`, error);
- reportToLogster(name, error);
+ const errorData = {
+ message: `${name} theme/component is throwing errors`,
+ stacktrace: error.stack
+ };
+ reportToLogster(errorData);
const currentUser = api.getCurrentUser();
if (!currentUser || !currentUser.admin) {