Node.js based forum software built for the modern web
#2347
barisusaklidd135b875b37
diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.jsindex 6a26e7120e..a87c67a303 100644--- a/public/src/client/topic/postTools.js+++ b/public/src/client/topic/postTools.js@@ -20,10 +20,11 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(comPostTools.toggle = function(pid, isDeleted) {var postEl = $('#post-container li[data-pid="' + pid + '"]');- postEl.find('.quote, .favourite, .post_reply, .chat').toggleClass('hidden', isDeleted);+ postEl.find('.quote, .favourite, .post_reply, .chat, .flag').toggleClass('hidden', isDeleted);postEl.find('.purge').toggleClass('hidden', !isDeleted);postEl.find('.delete .i').toggleClass('fa-trash-o', !isDeleted).toggleClass('fa-history', isDeleted);postEl.find('.delete span').translateHtml(isDeleted ? ' [[topic:restore]]' : ' [[topic:delete]]');+};PostTools.updatePostCount = function() {diff --git a/src/socket.io/posts.js b/src/socket.io/posts.jsindex 0cb493cd80..773bf79b45 100644--- a/src/socket.io/posts.js+++ b/src/socket.io/posts.js@@ -99,11 +99,22 @@ function favouriteCommand(command, eventName, socket, data, callback) {if(!data || !data.pid || !data.room_id) {return;}- posts.exists(data.pid, function(err, exists) {- if (err || !exists) {+ async.parallel({+ exists: function(next) {+ posts.exists(data.pid, next);+ },+ deleted: function(next) {+ posts.getPostField(data.pid, 'deleted', next);+ }+ }, function(err, results) {+ if (err || !results.exists) {return callback(err);}+ if (parseInt(results.deleted, 10) === 1) {+ return callback(new Error('[[error:post-deleted]]'));+ }+favourites[command](data.pid, socket.uid, function(err, result) {if (err) {return callback(err);@@ -301,9 +312,12 @@ SocketPosts.flag = function(socket, pid, callback) {}userName = userData.username;- posts.getPostFields(pid, ['tid', 'uid', 'content'], next);+ posts.getPostFields(pid, ['tid', 'uid', 'content', 'deleted'], next);},function(postData, next) {+ if (parseInt(postData.deleted) === 1) {+ return next(new Error('[[error:post-deleted]]'));+ }post = postData;topics.getTopicField(postData.tid, 'title', next);},