adding filter hooks for flag list and retrieval

v1.18.x
Julian Lam 8 years ago
parent 2d04bb9d33
commit f4fb9ee04b

@ -46,6 +46,13 @@ Flags.get = function (flagId, callback) {
}));
});
},
function (flagObj, next) {
plugins.fireHook('filter:flags.get', {
flag: flagObj,
}, function (err, data) {
next(err, data.flag);
});
},
], callback);
};
@ -181,6 +188,13 @@ Flags.list = function (filters, uid, callback) {
});
}, next);
},
function (flags, next) {
plugins.fireHook('filter:flags.list', {
flags: flags,
}, function (err, data) {
next(err, data.flags);
});
},
], callback);
};
@ -505,7 +519,8 @@ Flags.update = function (flagId, uid, changeset, callback) {
tasks.push(async.apply(Flags.appendHistory, flagId, uid, changeset));
// Fire plugin hook
tasks.push(async.apply(plugins.fireHook, 'action:flag.update', { flagId: flagId, changeset: changeset, uid: uid }));
tasks.push(async.apply(plugins.fireHook, 'action:flag.update', { flagId: flagId, changeset: changeset, uid: uid })); // delete @ NodeBB v1.6.0
tasks.push(async.apply(plugins.fireHook, 'action:flags.update', { flagId: flagId, changeset: changeset, uid: uid }));
async.parallel(tasks, function (err) {
return next(err);
@ -644,6 +659,9 @@ Flags.notify = function (flagObj, uid, callback) {
plugins.fireHook('action:flag.create', {
flag: flagObj,
}); // delete @ NodeBB v1.6.0
plugins.fireHook('action:flags.create', {
flag: flagObj,
});
notifications.push(notification, results.admins.concat(results.moderators).concat(results.globalMods), callback);
});
@ -673,6 +691,9 @@ Flags.notify = function (flagObj, uid, callback) {
plugins.fireHook('action:flag.create', {
flag: flagObj,
}); // delete @ NodeBB v1.6.0
plugins.fireHook('action:flags.create', {
flag: flagObj,
});
notifications.push(notification, results.admins.concat(results.globalMods), callback);
});

@ -9,6 +9,8 @@ module.exports = function (Plugins) {
'filter:post.save': 'filter:post.create',
'filter:user.profileLinks': 'filter:user.profileMenu',
'action:post.flag': 'action:flag.create',
'action:flag.create': 'action:flags.create',
'action:flag.update': 'action:flags.update',
};
/*
`data` is an object consisting of (* is required):

Loading…
Cancel
Save