Collection memberships required to be preloaded before publishing a document (#5187)

This commit is contained in:
Apoorv Mishra
2023-04-12 05:08:25 +05:30
committed by GitHub
parent 9da99f6955
commit 21d6fbed87

View File

@@ -915,7 +915,9 @@ router.post(
collectionId,
"collectionId is required to publish a draft without collection"
);
collection = await Collection.findByPk(collectionId as string);
collection = await Collection.scope({
method: ["withMembership", user.id],
}).findByPk(collectionId!);
}
authorize(user, "publish", collection);
}