notification changes

-only send a notification when the person you follow creates a topic
-you still get a notification per post if you are following a topic
-changed notifications.push so that it sends the notifications over a
period of time, currently to 50 users per second
-optimized topics.notifyFollowers and
user.notifications.sendTopicNotification, they no longer query the
database for the topic and post data instead they get it as params
-you can no longer follow yourself :)
-changed mongo sortedSetRemove so that it doesn't use $in if there is
only a single value to remove
This commit is contained in:
barisusakli
2014-10-15 21:55:31 -04:00
parent eb546dfaab
commit 9e8be432b3
7 changed files with 98 additions and 86 deletions

View File

@@ -61,18 +61,21 @@ module.exports = function(db, module) {
};
module.sortedSetRemove = function(key, value, callback) {
function done(err) {
callback(err);
}
callback = callback || helpers.noop;
if (!key) {
return callback();
}
if (!Array.isArray(value)) {
value = [value];
}
value = value.map(helpers.valueToString);
db.collection('objects').remove({_key: key, value: {$in: value}}, function(err) {
callback(err);
});
if (Array.isArray(value)) {
value = value.map(helpers.valueToString);
db.collection('objects').remove({_key: key, value: {$in: value}}, done);
} else {
value = helpers.valueToString(value);
db.collection('objects').remove({_key: key, value: value}, done);
}
};
module.sortedSetsRemove = function(keys, value, callback) {