mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
check nid before pusing and marking read
This commit is contained in:
@@ -120,6 +120,11 @@ var async = require('async'),
|
|||||||
|
|
||||||
Notifications.push = function(notification, uids, callback) {
|
Notifications.push = function(notification, uids, callback) {
|
||||||
callback = callback || function() {};
|
callback = callback || function() {};
|
||||||
|
|
||||||
|
if (!notification.nid) {
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
|
||||||
var websockets = require('./socket.io');
|
var websockets = require('./socket.io');
|
||||||
if (!Array.isArray(uids)) {
|
if (!Array.isArray(uids)) {
|
||||||
uids = [uids];
|
uids = [uids];
|
||||||
@@ -183,7 +188,7 @@ var async = require('async'),
|
|||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
var notificationKeys = nids.map(function(nid) {
|
var notificationKeys = nids.filter(Boolean).map(function(nid) {
|
||||||
return 'notifications:' + nid;
|
return 'notifications:' + nid;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -71,10 +71,8 @@ var async = require('async'),
|
|||||||
winston.info('[notifications.get] nid ' + nids[index] + ' not found. Removing.');
|
winston.info('[notifications.get] nid ' + nids[index] + ' not found. Removing.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nids[index]) {
|
|
||||||
deletedNids.push(nids[index]);
|
deletedNids.push(nids[index]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (deletedNids.length) {
|
if (deletedNids.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user