mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
fix: no need to pass in empty Set in deprecated hooks
This commit is contained in:
@@ -12,25 +12,21 @@ Hooks._deprecated = new Map([
|
|||||||
new: 'static:email.send',
|
new: 'static:email.send',
|
||||||
since: 'v1.17.0',
|
since: 'v1.17.0',
|
||||||
until: 'v2.0.0',
|
until: 'v2.0.0',
|
||||||
affected: new Set(),
|
|
||||||
}],
|
}],
|
||||||
['filter:router.page', {
|
['filter:router.page', {
|
||||||
new: 'response:router.page',
|
new: 'response:router.page',
|
||||||
since: 'v1.15.3',
|
since: 'v1.15.3',
|
||||||
until: 'v2.1.0',
|
until: 'v2.1.0',
|
||||||
affected: new Set(),
|
|
||||||
}],
|
}],
|
||||||
['filter:post.purge', {
|
['filter:post.purge', {
|
||||||
new: 'filter:posts.purge',
|
new: 'filter:posts.purge',
|
||||||
since: 'v1.19.6',
|
since: 'v1.19.6',
|
||||||
until: 'v2.1.0',
|
until: 'v2.1.0',
|
||||||
affected: new Set(),
|
|
||||||
}],
|
}],
|
||||||
['action:post.purge', {
|
['action:post.purge', {
|
||||||
new: 'action:posts.purge',
|
new: 'action:posts.purge',
|
||||||
since: 'v1.19.6',
|
since: 'v1.19.6',
|
||||||
until: 'v2.1.0',
|
until: 'v2.1.0',
|
||||||
affected: new Set(),
|
|
||||||
}],
|
}],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -63,6 +59,9 @@ Hooks.register = function (id, data) {
|
|||||||
// `hasOwnProperty` needed for hooks with no alternative (set to null)
|
// `hasOwnProperty` needed for hooks with no alternative (set to null)
|
||||||
if (Hooks._deprecated.has(data.hook)) {
|
if (Hooks._deprecated.has(data.hook)) {
|
||||||
const deprecation = Hooks._deprecated.get(data.hook);
|
const deprecation = Hooks._deprecated.get(data.hook);
|
||||||
|
if (!deprecation.hasOwnProperty('affected')) {
|
||||||
|
deprecation.affected = new Set();
|
||||||
|
}
|
||||||
deprecation.affected.add(id);
|
deprecation.affected.add(id);
|
||||||
Hooks._deprecated.set(data.hook, deprecation);
|
Hooks._deprecated.set(data.hook, deprecation);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ Plugins.reload = async function () {
|
|||||||
|
|
||||||
// Deprecation notices
|
// Deprecation notices
|
||||||
Plugins.hooks._deprecated.forEach((deprecation, hook) => {
|
Plugins.hooks._deprecated.forEach((deprecation, hook) => {
|
||||||
if (!deprecation.affected.size) {
|
if (!deprecation.affected || !deprecation.affected.size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user