fix: Passing publish=true in documents.update with published document errors

This commit is contained in:
Tom Moor
2024-02-23 21:02:52 -05:00
parent 7685637729
commit bc3271b4ab
2 changed files with 5 additions and 1 deletions

View File

@@ -3032,6 +3032,7 @@ describe("#documents.update", () => {
id: document.id,
title: "Updated title",
text: "Updated text",
publish: true,
},
});
const body = await res.json();

View File

@@ -990,7 +990,10 @@ router.post(
}
if (publish) {
authorize(user, "publish", document);
if (document.isDraft) {
authorize(user, "publish", document);
}
if (!document.collectionId) {
assertPresent(
collectionId,