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
|
type: boolean
|
||||||
read:
|
read:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
posts:view_deleted:
|
||||||
|
type: boolean
|
||||||
cid:
|
cid:
|
||||||
type: string
|
type: string
|
||||||
uid:
|
uid:
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ module.exports = function (Categories) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Categories.modifyTopicsByPrivilege = function (topics, privileges) {
|
Categories.modifyTopicsByPrivilege = function (topics, privileges) {
|
||||||
if (!Array.isArray(topics) || !topics.length || privileges.isAdminOrMod) {
|
if (!Array.isArray(topics) || !topics.length || privileges.view_deleted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,10 @@ privsCategories.list = async function (cid) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
privsCategories.get = async function (cid, uid) {
|
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([
|
const [userPrivileges, isAdministrator, isModerator] = await Promise.all([
|
||||||
helpers.isAllowedTo(privs, uid, cid),
|
helpers.isAllowedTo(privs, uid, cid),
|
||||||
@@ -95,7 +98,7 @@ privsCategories.get = async function (cid, uid) {
|
|||||||
cid: cid,
|
cid: cid,
|
||||||
uid: uid,
|
uid: uid,
|
||||||
editable: isAdminOrMod,
|
editable: isAdminOrMod,
|
||||||
view_deleted: isAdminOrMod,
|
view_deleted: isAdminOrMod || privData['posts:view_deleted'],
|
||||||
isAdminOrMod: isAdminOrMod,
|
isAdminOrMod: isAdminOrMod,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ privsTopics.get = async function (tid, uid) {
|
|||||||
view_thread_tools: editable || deletable,
|
view_thread_tools: editable || deletable,
|
||||||
editable: editable,
|
editable: editable,
|
||||||
deletable: deletable,
|
deletable: deletable,
|
||||||
view_deleted: isAdminOrMod || isOwner,
|
view_deleted: isAdminOrMod || isOwner || privData['posts:view_deleted'],
|
||||||
isAdminOrMod: isAdminOrMod,
|
isAdminOrMod: isAdminOrMod,
|
||||||
disabled: disabled,
|
disabled: disabled,
|
||||||
tid: tid,
|
tid: tid,
|
||||||
|
|||||||
Reference in New Issue
Block a user