passing in a picture into notifications now

This commit is contained in:
Julian Lam
2014-02-15 15:43:44 -05:00
parent ef45ae9ba3
commit 9e64f4e303
6 changed files with 34 additions and 10 deletions

View File

@@ -4,7 +4,8 @@ var async = require('async'),
db = require('./database'),
utils = require('../public/src/utils'),
events = require('./events');
events = require('./events'),
User = require('./user');
(function(Notifications) {
"use strict";
@@ -27,10 +28,17 @@ var async = require('async'),
if (exists) {
db.sortedSetRank('uid:' + uid + ':notifications:read', nid, function(err, rank) {
db.getObjectFields('notifications:' + nid, ['nid', 'text', 'score', 'path', 'datetime', 'uniqueId'], function(err, notification) {
db.getObjectFields('notifications:' + nid, ['nid', 'from', 'text', 'score', 'path', 'datetime', 'uniqueId'], function(err, notification) {
notification.read = rank !== null ? true:false;
callback(notification);
if (notification.from) {
User.getUserField(notification.from, 'picture', function(err, picture) {
notification.image = picture;
callback(notification);
});
} else {
callback(notification);
}
});
});
} else {