Skip to content

Commit

Permalink
Merge pull request #4203 from apostrophecms/pro-4017-fix-page-post-route
Browse files Browse the repository at this point in the history
uses findForEditing in the put route like we do in the post one
  • Loading branch information
ValJed committed Jun 19, 2023
2 parents e093215 + 4527931 commit ec22581
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## UNRELEASED

### Fixes

* Uses `findForEditing` method in the page put route.

### Adds

* Adds the possibility to add custom admin bars via the `addBar()` method from the `admin-bar` module.
Expand Down
3 changes: 2 additions & 1 deletion modules/@apostrophecms/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,9 @@ module.exports = {
async put(req, _id) {
_id = self.inferIdLocaleAndMode(req, _id);
self.publicApiCheck(req);

return self.withLock(req, async () => {
const page = await self.find(req, { _id }).toObject();
const page = await self.findForEditing(req, { _id }).toObject();
if (!page) {
throw self.apos.error('notfound');
}
Expand Down

0 comments on commit ec22581

Please sign in to comment.