mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
closes #1577
This commit is contained in:
@@ -113,8 +113,18 @@ define(['forum/topic/browsing', 'forum/topic/postTools', 'forum/topic/threadTool
|
||||
|
||||
if (postEl.length) {
|
||||
postEl.toggleClass('deleted');
|
||||
var isDeleted = postEl.hasClass('deleted');
|
||||
postTools.toggle(data.pid, isDeleted);
|
||||
|
||||
postTools.toggle(data.pid, postEl.hasClass('deleted'));
|
||||
if (!app.isAdmin && parseInt(data.uid, 10) !== parseInt(app.uid, 10)) {
|
||||
if (isDeleted) {
|
||||
translator.translate('[[topic:post_is_deleted]]', function(translated) {
|
||||
postEl.find('.post-content').html(translated);
|
||||
});
|
||||
} else {
|
||||
postEl.find('.post-content').html(data.content);
|
||||
}
|
||||
}
|
||||
|
||||
postTools.updatePostCount();
|
||||
}
|
||||
|
@@ -146,7 +146,7 @@ var winston = require('winston'),
|
||||
|
||||
db.incrObjectFieldBy('global', 'postCount', isDelete ? -1 : 1);
|
||||
|
||||
posts.getPostFields(pid, ['tid', 'uid', 'content'], function(err, postData) {
|
||||
posts.getPostFields(pid, ['pid', 'tid', 'uid', 'content'], function(err, postData) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@@ -170,7 +170,16 @@ var winston = require('winston'),
|
||||
function(next) {
|
||||
addOrRemoveFromCategoryRecentPosts(pid, postData.tid, isDelete, next);
|
||||
}
|
||||
], callback);
|
||||
], function(err) {
|
||||
if (!isDelete) {
|
||||
PostTools.parse(postData.content, function(err, parsed) {
|
||||
postData.content = parsed;
|
||||
callback(err, postData);
|
||||
});
|
||||
return;
|
||||
}
|
||||
callback(err, postData);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -188,7 +188,7 @@ function deleteOrRestore(command, socket, data, callback) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
postTools[command](socket.uid, data.pid, function(err) {
|
||||
postTools[command](socket.uid, data.pid, function(err, postData) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
@@ -196,9 +196,7 @@ function deleteOrRestore(command, socket, data, callback) {
|
||||
module.parent.exports.emitTopicPostStats();
|
||||
|
||||
var eventName = command === 'restore' ? 'event:post_restored' : 'event:post_deleted';
|
||||
websockets.server.sockets.in('topic_' + data.tid).emit(eventName, {
|
||||
pid: data.pid
|
||||
});
|
||||
websockets.server.sockets.in('topic_' + data.tid).emit(eventName, postData);
|
||||
|
||||
callback();
|
||||
});
|
||||
|
Reference in New Issue
Block a user