more fixes

This commit is contained in:
barisusakli
2014-07-28 17:50:49 -04:00
parent dfb6606432
commit f71bd41408
6 changed files with 21 additions and 18 deletions

View File

@@ -90,19 +90,19 @@ function favouriteCommand(command, eventName, socket, data, callback) {
}
}
function sendNotificationToPostOwner(data, uid, notification) {
if(data && data.pid && uid) {
function sendNotificationToPostOwner(data, fromuid, notification) {
if(data && data.pid && fromuid) {
posts.getPostFields(data.pid, ['tid', 'uid'], function(err, postData) {
if (err) {
return;
}
if (uid === parseInt(postData.uid, 10)) {
if (fromuid === parseInt(postData.uid, 10)) {
return;
}
async.parallel({
username: async.apply(user.getUserField, uid, 'username'),
username: async.apply(user.getUserField, fromuid, 'username'),
slug: async.apply(topics.getTopicField, postData.tid, 'slug'),
index: async.apply(posts.getPidIndex, data.pid),
postContent: function(next) {
@@ -122,8 +122,8 @@ function sendNotificationToPostOwner(data, uid, notification) {
bodyShort: '[[' + notification + ', ' + results.username + ']]',
bodyLong: results.postContent,
path: nconf.get('relative_path') + '/topic/' + results.slug + '/' + results.index,
uniqueId: 'post:' + data.pid,
from: uid
uniqueId: 'post:' + data.pid + ':uid:' + fromuid,
from: fromuid
}, function(err, nid) {
if (!err) {
notifications.push(nid, [postData.uid]);