fix flagging and post filter

cant flag posts that don't exist anymore
This commit is contained in:
barisusakli
2014-11-11 18:34:29 -05:00
parent 11dc477dde
commit d2cddc734b
3 changed files with 24 additions and 14 deletions

View File

@@ -303,6 +303,9 @@ SocketPosts.flag = function(socket, pid, callback) {
post;
async.waterfall([
function(next) {
posts.flag(pid, next);
},
function(next) {
user.getUserFields(socket.uid, ['username', 'reputation'], next);
},
@@ -323,7 +326,7 @@ SocketPosts.flag = function(socket, pid, callback) {
},
function(topicTitle, next) {
message = '[[notifications:user_flagged_post_in, ' + userName + ', ' + topicTitle + ']]';
postTools.parse(post, socket.uid, next);
postTools.parsePost(post, socket.uid, next);
},
function(post, next) {
groups.get('administrators', {}, next);
@@ -342,9 +345,6 @@ SocketPosts.flag = function(socket, pid, callback) {
notifications.push(notification, adminGroup.members, next);
});
},
function(next) {
posts.flag(pid, next);
},
function(next) {
if (!parseInt(post.uid, 10)) {
return next();