fix: Nested document menu item appears where it shouldnt (#1193)
This commit is contained in:
@@ -43,26 +43,42 @@ allow(User, ['star', 'unstar'], Document, (user, document) => {
|
||||
});
|
||||
|
||||
allow(User, 'update', Document, (user, document) => {
|
||||
if (document.archivedAt) return false;
|
||||
if (document.deletedAt) return false;
|
||||
|
||||
invariant(
|
||||
document.collection,
|
||||
'collection is missing, did you forget to include in the query scope?'
|
||||
);
|
||||
if (cannot(user, 'update', document.collection)) return false;
|
||||
|
||||
return user.teamId === document.teamId;
|
||||
});
|
||||
|
||||
allow(User, 'createChildDocument', Document, (user, document) => {
|
||||
if (document.archivedAt) return false;
|
||||
if (document.deletedAt) return false;
|
||||
if (document.archivedAt) return false;
|
||||
if (!document.publishedAt) return false;
|
||||
|
||||
invariant(
|
||||
document.collection,
|
||||
'collection is missing, did you forget to include in the query scope?'
|
||||
);
|
||||
if (cannot(user, 'update', document.collection)) return false;
|
||||
|
||||
return user.teamId === document.teamId;
|
||||
});
|
||||
|
||||
allow(User, ['move', 'pin', 'unpin'], Document, (user, document) => {
|
||||
if (document.archivedAt) return false;
|
||||
if (document.deletedAt) return false;
|
||||
if (!document.publishedAt) return false;
|
||||
|
||||
invariant(
|
||||
document.collection,
|
||||
'collection is missing, did you forget to include in the query scope?'
|
||||
);
|
||||
if (cannot(user, 'update', document.collection)) return false;
|
||||
if (document.archivedAt) return false;
|
||||
if (document.deletedAt) return false;
|
||||
if (!document.publishedAt) return false;
|
||||
|
||||
return user.teamId === document.teamId;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user