mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
added pushGroup method to notifications object #1331
This commit is contained in:
@@ -9,6 +9,7 @@ var async = require('async'),
|
||||
utils = require('../public/src/utils'),
|
||||
events = require('./events'),
|
||||
User = require('./user'),
|
||||
groups = require('./groups'),
|
||||
meta = require('./meta');
|
||||
|
||||
(function(Notifications) {
|
||||
@@ -129,12 +130,29 @@ var async = require('async'),
|
||||
|
||||
}, function(err) {
|
||||
if (callback) {
|
||||
callback(true);
|
||||
callback(null, true);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Note: This method used in mentions plugin. If still unused in core as of 0.6.0, please move to mentions plugin itself.
|
||||
Notifications.pushGroup = function(nid, groupName, callback) {
|
||||
if (!callback) {
|
||||
callback = function() {};
|
||||
}
|
||||
|
||||
groups.get(groupName, {}, function(err, groupObj) {
|
||||
if (!err && groupObj) {
|
||||
if (groupObj.memberCount > 0) {
|
||||
Notifications.push(nid, groupObj.members, callback);
|
||||
}
|
||||
} else {
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function checkReplace(uniqueId, uid, newNotifObj, callback) {
|
||||
var replace = false, matched = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user