notifications.create can return null

This commit is contained in:
barisusakli
2016-01-27 20:03:28 +02:00
parent 19c7411c38
commit add4e6ee5b
6 changed files with 49 additions and 51 deletions

View File

@@ -50,14 +50,11 @@ module.exports = function(User) {
nid: 'new_register:' + username,
path: '/admin/manage/registration'
}, function(err, notification) {
if (err) {
if (err || !notification) {
return callback(err);
}
if (notification) {
notifications.pushGroup(notification, 'administrators', callback);
} else {
callback();
}
notifications.pushGroup(notification, 'administrators', callback);
});
}

View File

@@ -295,14 +295,11 @@ var async = require('async'),
path: path,
nid: 'welcome_' + uid
}, function(err, notification) {
if (err) {
if (err || !notification) {
return callback(err);
}
if (notification) {
notifications.push(notification, [uid], callback);
} else {
callback();
}
notifications.push(notification, [uid], callback);
});
};