mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 00:56:13 +01:00
show deleted replies like regular deleted posts
This commit is contained in:
10
src/posts.js
10
src/posts.js
@@ -260,4 +260,14 @@ var plugins = require('./plugins');
|
||||
});
|
||||
};
|
||||
|
||||
Posts.modifyPostByPrivilege = function (post, isAdminOrMod) {
|
||||
if (post.deleted && !(isAdminOrMod || post.selfPost)) {
|
||||
post.content = '[[topic:post_is_deleted]]';
|
||||
if (post.user) {
|
||||
post.user.signature = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}(exports));
|
||||
|
||||
@@ -26,7 +26,7 @@ module.exports = function (privileges) {
|
||||
function (cids, next) {
|
||||
async.parallel({
|
||||
isAdmin: async.apply(user.isAdministrator, uid),
|
||||
isModerator: async.apply(posts.isModerator, pids, uid),
|
||||
isModerator: async.apply(user.isModerator, uid, cids),
|
||||
isOwner: async.apply(posts.isOwner, pids, uid),
|
||||
'topics:read': async.apply(helpers.isUserAllowedTo, 'topics:read', uid, cids),
|
||||
read: async.apply(helpers.isUserAllowedTo, 'read', uid, cids),
|
||||
|
||||
@@ -122,23 +122,32 @@ SocketPosts.getReplies = function (socket, pid, callback) {
|
||||
if (!utils.isNumber(pid)) {
|
||||
return callback(new Error('[[error:invalid-data]'));
|
||||
}
|
||||
var postPrivileges;
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
posts.getPidsFromSet('pid:' + pid + ':replies', 0, -1, false, next);
|
||||
},
|
||||
function (pids, next) {
|
||||
privileges.posts.filter('read', pids, socket.uid, next);
|
||||
async.parallel({
|
||||
posts: function (next) {
|
||||
posts.getPostsByPids(pids, socket.uid, next);
|
||||
},
|
||||
privileges: function (next) {
|
||||
privileges.posts.get(pids, socket.uid, next);
|
||||
}
|
||||
}, next);
|
||||
},
|
||||
function (pids, next) {
|
||||
posts.getPostsByPids(pids, socket.uid, next);
|
||||
function (results, next) {
|
||||
postPrivileges = results.privileges;
|
||||
topics.addPostData(results.posts, socket.uid, next);
|
||||
},
|
||||
function (postData, next) {
|
||||
postData.forEach(function (postData) {
|
||||
posts.modifyPostByPrivilege(postData, postPrivileges.isAdminOrMod);
|
||||
});
|
||||
next(null, postData);
|
||||
}
|
||||
], function (err, postData) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
topics.addPostData(postData, socket.uid, callback);
|
||||
});
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -148,12 +148,7 @@ module.exports = function (Topics) {
|
||||
post.display_post_menu = topicPrivileges.isAdminOrMod || (post.selfPost && !topicData.locked) || ((loggedIn || topicData.postSharing.length) && !post.deleted);
|
||||
post.ip = topicPrivileges.isAdminOrMod ? post.ip : undefined;
|
||||
|
||||
if (post.deleted && !(topicPrivileges.isAdminOrMod || post.selfPost)) {
|
||||
post.content = '[[topic:post_is_deleted]]';
|
||||
if (post.user) {
|
||||
post.user.signature = '';
|
||||
}
|
||||
}
|
||||
posts.modifyPostByPrivilege(post, topicPrivileges.isAdminOrMod);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user