mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 17:20:44 +08:00
FIX: Limit requests and include data when reporting deprecated icons
- Only report each icon to the server once, to avoid hitting rate limits
- Correct typo in ajax `data` parameter
Follow-up to db7d00a8dc
This commit is contained in:
parent
fdea0a0838
commit
7737ecd0fe
|
@ -580,21 +580,25 @@ function warnIfMissing(id) {
|
|||
}
|
||||
}
|
||||
|
||||
const reportedIcons = [];
|
||||
|
||||
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.`
|
||||
);
|
||||
if (!Discourse.testing) {
|
||||
if (!Discourse.testing && !reportedIcons.includes(oldId)) {
|
||||
const errorData = {
|
||||
message: `FA icon deprecation: replace "${oldId}"" with "${newId}".`,
|
||||
stacktrace: Error().stack
|
||||
};
|
||||
|
||||
Ember.$.ajax(`${Discourse.BaseUri}/logs/report_js_error`, {
|
||||
errorData,
|
||||
data: errorData,
|
||||
type: "POST",
|
||||
cache: false
|
||||
});
|
||||
|
||||
reportedIcons.push(oldId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user