mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
refactor: move plugin hook methods to plugin.hooks.*
This commit is contained in:
@@ -38,7 +38,7 @@ Notifications.privilegedTypes = [
|
||||
];
|
||||
|
||||
Notifications.getAllNotificationTypes = async function () {
|
||||
const results = await plugins.fireHook('filter:user.notificationTypes', {
|
||||
const results = await plugins.hooks.fire('filter:user.notificationTypes', {
|
||||
types: Notifications.baseTypes.slice(),
|
||||
privilegedTypes: Notifications.privilegedTypes.slice(),
|
||||
});
|
||||
@@ -213,7 +213,7 @@ async function pushToUids(uids, notification) {
|
||||
|
||||
// Remove uid from recipients list if they have blocked the user triggering the notification
|
||||
uids = await User.blocks.filterUids(notification.from, uids);
|
||||
const data = await plugins.fireHook('filter:notification.push', { notification: notification, uids: uids });
|
||||
const data = await plugins.hooks.fire('filter:notification.push', { notification: notification, uids: uids });
|
||||
if (!data || !data.notification || !data.uids || !data.uids.length) {
|
||||
return;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ async function pushToUids(uids, notification) {
|
||||
sendNotification(results.uidsToNotify),
|
||||
sendEmail(results.uidsToEmail),
|
||||
]);
|
||||
plugins.fireHook('action:notification.pushed', {
|
||||
plugins.hooks.fire('action:notification.pushed', {
|
||||
notification: notification,
|
||||
uids: results.uidsToNotify,
|
||||
uidsNotified: results.uidsToNotify,
|
||||
@@ -419,7 +419,7 @@ Notifications.merge = async function (notifications) {
|
||||
return notifications;
|
||||
}, notifications);
|
||||
|
||||
const data = await plugins.fireHook('filter:notifications.merge', {
|
||||
const data = await plugins.hooks.fire('filter:notifications.merge', {
|
||||
notifications: notifications,
|
||||
});
|
||||
return data && data.notifications;
|
||||
|
||||
Reference in New Issue
Block a user