From e32d2309744021b3f8ea6ed7292de79f07f5e11c Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Mon, 2 Dec 2013 17:48:21 -0500 Subject: [PATCH] format --- src/notifications.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/notifications.js b/src/notifications.js index 801995c4d6..06786119dd 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -16,7 +16,7 @@ var RDB = require('./redis'), } new cron('0 0 * * *', Notifications.prune, null, true); }; - + Notifications.get = function(nid, uid, callback) { RDB.multi() .hmget('notifications:' + nid, 'text', 'score', 'path', 'datetime', 'uniqueId') @@ -41,7 +41,7 @@ var RDB = require('./redis'), }); }); }; - + Notifications.create = function(text, path, uniqueId, callback) { /** * uniqueId is used solely to override stale nids. @@ -63,7 +63,7 @@ var RDB = require('./redis'), }); }); }; - + function destroy(nid) { var multi = RDB.multi(); @@ -77,9 +77,11 @@ var RDB = require('./redis'), } }); } - + Notifications.push = function(nid, uids, callback) { - if (!Array.isArray(uids)) uids = [uids]; + if (!Array.isArray(uids)) { + uids = [uids]; + } var numUids = uids.length, x; @@ -102,7 +104,7 @@ var RDB = require('./redis'), } }); }; - + function remove_by_uniqueId(uniqueId, uid, callback) { async.parallel([ function(next) { @@ -149,7 +151,7 @@ var RDB = require('./redis'), } }); } - + Notifications.mark_read = function(nid, uid, callback) { if (parseInt(uid) > 0) { Notifications.get(nid, uid, function(notif_data) { @@ -161,7 +163,7 @@ var RDB = require('./redis'), }); } } - + Notifications.mark_read_multiple = function(nids, uid, callback) { if (!Array.isArray(nids) && parseInt(nids, 10) > 0) { nids = [nids]; @@ -179,7 +181,7 @@ var RDB = require('./redis'), } }); }; - + Notifications.mark_all_read = function(uid, callback) { RDB.zrange('uid:' + uid + ':notifications:unread', 0, 10, function(err, nids) { if (err) { @@ -195,7 +197,7 @@ var RDB = require('./redis'), } }); }; - + Notifications.prune = function(cutoff) { if (process.env.NODE_ENV === 'development') { winston.info('[notifications.prune] Removing expired notifications from the database.'); @@ -269,6 +271,6 @@ var RDB = require('./redis'), } }); }; - + }(exports));