This commit is contained in:
Barış Soner Uşaklı
2015-02-19 15:56:04 -05:00
parent 4ba6d44858
commit 743cd20441
10 changed files with 229 additions and 85 deletions

View File

@@ -422,14 +422,14 @@ SocketPosts.flag = function(socket, pid, callback) {
return next(new Error('[[error:not-enough-reputation-to-flag]]'));
}
userName = userData.username;
posts.getPostFields(pid, ['tid', 'uid', 'content', 'deleted'], next);
posts.getPostFields(pid, ['pid', 'tid', 'uid', 'content', 'deleted'], next);
},
function(postData, next) {
if (parseInt(postData.deleted, 10) === 1) {
return next(new Error('[[error:post-deleted]]'));
}
post = postData;
posts.flag(pid, next);
posts.flag(post, socket.uid, next);
},
function(next) {
topics.getTopicFields(post.tid, ['title', 'cid'], next);
@@ -462,14 +462,7 @@ SocketPosts.flag = function(socket, pid, callback) {
}
notifications.push(notification, results.admins.concat(results.moderators), next);
});
},
function(next) {
if (!parseInt(post.uid, 10)) {
return next();
}
db.setAdd('uid:' + post.uid + ':flagged_by', socket.uid, next);
}
}
], callback);
};