fix: Policies on archived documents disallow unarchive (#6862)

This commit is contained in:
Tom Moor
2024-05-01 21:02:01 -04:00
committed by GitHub
parent 3298a1cd7d
commit 8dc530a50f
4 changed files with 35 additions and 15 deletions

View File

@@ -210,17 +210,7 @@ router.post(
const { sort, direction } = ctx.input.body;
const { user } = ctx.state.auth;
const collectionIds = await user.collectionIds();
const collectionScope: Readonly<ScopeOptions> = {
method: ["withCollectionPermissions", user.id],
};
const viewScope: Readonly<ScopeOptions> = {
method: ["withViews", user.id],
};
const documents = await Document.scope([
"defaultScope",
collectionScope,
viewScope,
]).findAll({
const documents = await Document.defaultScopeWithUser(user.id).findAll({
where: {
teamId: user.teamId,
collectionId: collectionIds,