mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #9414, use posts:view_deleted
This commit is contained in:
@@ -72,6 +72,8 @@ get:
|
||||
type: boolean
|
||||
read:
|
||||
type: boolean
|
||||
posts:view_deleted:
|
||||
type: boolean
|
||||
cid:
|
||||
type: string
|
||||
uid:
|
||||
|
||||
@@ -147,7 +147,7 @@ module.exports = function (Categories) {
|
||||
};
|
||||
|
||||
Categories.modifyTopicsByPrivilege = function (topics, privileges) {
|
||||
if (!Array.isArray(topics) || !topics.length || privileges.isAdminOrMod) {
|
||||
if (!Array.isArray(topics) || !topics.length || privileges.view_deleted) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,10 @@ privsCategories.list = async function (cid) {
|
||||
};
|
||||
|
||||
privsCategories.get = async function (cid, uid) {
|
||||
const privs = ['topics:create', 'topics:read', 'topics:tag', 'read'];
|
||||
const privs = [
|
||||
'topics:create', 'topics:read', 'topics:tag',
|
||||
'read', 'posts:view_deleted',
|
||||
];
|
||||
|
||||
const [userPrivileges, isAdministrator, isModerator] = await Promise.all([
|
||||
helpers.isAllowedTo(privs, uid, cid),
|
||||
@@ -95,7 +98,7 @@ privsCategories.get = async function (cid, uid) {
|
||||
cid: cid,
|
||||
uid: uid,
|
||||
editable: isAdminOrMod,
|
||||
view_deleted: isAdminOrMod,
|
||||
view_deleted: isAdminOrMod || privData['posts:view_deleted'],
|
||||
isAdminOrMod: isAdminOrMod,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ privsTopics.get = async function (tid, uid) {
|
||||
view_thread_tools: editable || deletable,
|
||||
editable: editable,
|
||||
deletable: deletable,
|
||||
view_deleted: isAdminOrMod || isOwner,
|
||||
view_deleted: isAdminOrMod || isOwner || privData['posts:view_deleted'],
|
||||
isAdminOrMod: isAdminOrMod,
|
||||
disabled: disabled,
|
||||
tid: tid,
|
||||
|
||||
Reference in New Issue
Block a user