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

This commit is contained in:
Apoorv Mishra authored and GitHub committed 2023-04-11 16:38:25 -07:00
1 parent 9da99f6955
commit 21d6fbed87
1 file changed
+3 -1
+3 -1
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);
}