mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
adding filter hooks for flag list and retrieval
This commit is contained in:
23
src/flags.js
23
src/flags.js
@@ -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);
|
], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -181,6 +188,13 @@ Flags.list = function (filters, uid, callback) {
|
|||||||
});
|
});
|
||||||
}, next);
|
}, next);
|
||||||
},
|
},
|
||||||
|
function (flags, next) {
|
||||||
|
plugins.fireHook('filter:flags.list', {
|
||||||
|
flags: flags,
|
||||||
|
}, function (err, data) {
|
||||||
|
next(err, data.flags);
|
||||||
|
});
|
||||||
|
},
|
||||||
], callback);
|
], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -505,7 +519,8 @@ Flags.update = function (flagId, uid, changeset, callback) {
|
|||||||
tasks.push(async.apply(Flags.appendHistory, flagId, uid, changeset));
|
tasks.push(async.apply(Flags.appendHistory, flagId, uid, changeset));
|
||||||
|
|
||||||
// Fire plugin hook
|
// 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) {
|
async.parallel(tasks, function (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
@@ -644,6 +659,9 @@ Flags.notify = function (flagObj, uid, callback) {
|
|||||||
|
|
||||||
plugins.fireHook('action:flag.create', {
|
plugins.fireHook('action:flag.create', {
|
||||||
flag: flagObj,
|
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);
|
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', {
|
plugins.fireHook('action:flag.create', {
|
||||||
flag: flagObj,
|
flag: flagObj,
|
||||||
|
}); // delete @ NodeBB v1.6.0
|
||||||
|
plugins.fireHook('action:flags.create', {
|
||||||
|
flag: flagObj,
|
||||||
});
|
});
|
||||||
notifications.push(notification, results.admins.concat(results.globalMods), callback);
|
notifications.push(notification, results.admins.concat(results.globalMods), callback);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ module.exports = function (Plugins) {
|
|||||||
'filter:post.save': 'filter:post.create',
|
'filter:post.save': 'filter:post.create',
|
||||||
'filter:user.profileLinks': 'filter:user.profileMenu',
|
'filter:user.profileLinks': 'filter:user.profileMenu',
|
||||||
'action:post.flag': 'action:flag.create',
|
'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):
|
`data` is an object consisting of (* is required):
|
||||||
|
|||||||
Reference in New Issue
Block a user