diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index 575e22c0f0..0b10e0d7f0 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -114,9 +114,14 @@ function sendNotificationToPostOwner(data, uid, notification) { return; } + var path = nconf.get('relative_path') + '/topic/' + results.slug; + if (parseInt(results.index, 10)) { + path += '/' + (parseInt(results.index, 10) + 1); + } + notifications.create({ text: '[[' + notification + ', ' + results.username + ']]', - path: nconf.get('relative_path') + '/topic/' + results.slug + '/' + results.index, + path: path, uniqueId: 'post:' + data.pid, from: uid }, function(nid) { @@ -284,7 +289,7 @@ SocketPosts.flag = function(socket, pid, callback) { posts.getPidIndex(pid, next); }, function(postIndex, next) { - path += '/' + postIndex; + path += '/' + (parseInt(postIndex, 10) + 1); groups.get('administrators', {}, next); }, function(adminGroup, next) { diff --git a/src/topics/follow.js b/src/topics/follow.js index 731963c623..4c11430212 100644 --- a/src/topics/follow.js +++ b/src/topics/follow.js @@ -38,9 +38,13 @@ module.exports = function(Topics) { return next(err); } + var path = nconf.get('relative_path') + '/topic/' + results.topicData.slug; + if (parseInt(results.postIndex, 10)) { + path += '/' + (parseInt(results.postIndex, 10) + 1); + } notifications.create({ text: '[[notifications:user_posted_to, ' + results.username + ', ' + results.topicData.title + ']]', - path: nconf.get('relative_path') + '/topic/' + results.topicData.slug + '/' + results.postIndex, + path: path, uniqueId: 'topic:' + tid, from: exceptUid }, function(nid) { diff --git a/src/user/notifications.js b/src/user/notifications.js index d2185c7a3a..8b34d45cbc 100644 --- a/src/user/notifications.js +++ b/src/user/notifications.js @@ -153,7 +153,7 @@ var async = require('async'), } async.parallel({ - usename: function(next) { + username: function(next) { user.getUserField(uid, 'username', next); }, slug: function(next) { @@ -168,10 +168,13 @@ var async = require('async'), } var message = '[[notifications:user_made_post, ' + results.username + ']]'; - + var path = nconf.get('relative_path') + '/topic/' + results.slug + '/' + results.postIndex; + if (parseInt(results.postIndex, 10)) { + path += '/' + (parseInt(results.postIndex, 10) + 1); + } notifications.create({ text: message, - path: nconf.get('relative_path') + '/topic/' + results.slug + '/' + results.postIndex, + path: path, uniqueId: 'topic:' + tid, from: uid }, function(nid) {