added new hook for notification pushing

v1.18.x
Julian Lam 11 years ago
parent 15c16c2502
commit dedc6d8154

@ -203,6 +203,13 @@ Executed whenever a post is created or edited, after it is saved into the databa
``action:post.restore``
^^^^^^^^^^^^^^^^^^^^^
``action:notification.pushed``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Argument(s)**: A notification object (javascript Object)
Executed whenever a notification is pushed to a user.
``action:config.set``
^^^^^^^^^^^^^^^^^^^^^

@ -11,7 +11,8 @@ var async = require('async'),
events = require('./events'),
User = require('./user'),
groups = require('./groups'),
meta = require('./meta');
meta = require('./meta'),
plugins = require('./plugins');
(function(Notifications) {
@ -125,7 +126,13 @@ var async = require('async'),
checkReplace(notif_data.uniqueId, uid, notif_data, function(err, replace) {
if (replace) {
db.sortedSetAdd('uid:' + uid + ':notifications:unread', notif_data.datetime, nid);
// Client-side
websockets.in('uid_' + uid).emit('event:new_notification', notif_data);
// Plugins
notif_data.uid = uid;
plugins.fireHook('action:notification.pushed', notif_data);
}
next();
});

Loading…
Cancel
Save