Collection memberships required to be preloaded before publishing a document (#5187)
This commit is contained in:
@@ -915,7 +915,9 @@ router.post(
|
|||||||
collectionId,
|
collectionId,
|
||||||
"collectionId is required to publish a draft without collection"
|
"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);
|
authorize(user, "publish", collection);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user