Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip next/previous info for old versions if it can't be obtained #1651

Merged
merged 3 commits into from
Jun 1, 2023

Conversation

davisagli
Copy link
Sponsor Member

Fixes #1650

If the item was renamed or moved, then its id might not be found in the current object's container. In that case let's degrade gracefully and leave out the previous_item and next_item rather than raising a ValueError.

@mister-roboto
Copy link

@davisagli thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@netlify
Copy link

netlify bot commented May 31, 2023

Deploy Preview for plone-restapi canceled.

Name Link
🔨 Latest commit c59999e
🔍 Latest deploy log https://app.netlify.com/sites/plone-restapi/deploys/6478bd1fd9244c00088926cc

@davisagli davisagli requested a review from jaroel May 31, 2023 21:09
@davisagli
Copy link
Sponsor Member Author

@jenkins-plone-org please run jobs

@sneridagh
Copy link
Member

@tisto could you please take a look, merge and release? Thx!

Copy link
Member

@jaroel jaroel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind that the shape of the response now has changed and the consuming code might need changes to reflect that.

Instead of having {previous_item: ..., next_item: ...}, these keys now will be missing from the response. imho this is more correct than {previous_item: null, next_item: null} as the object doesn't or can't provide the plone.app.dexterity.behaviors.nextprevious behaviour at all.

lgtm

@davisagli
Copy link
Sponsor Member Author

@tisto I updated it to return {previous_item: {}, next_item: {}} to match the format that is used when there is no previous item or next item (i.e. first/last item in container).

@tisto tisto merged commit 053a266 into master Jun 1, 2023
14 checks passed
@tisto tisto deleted the fix-serializer-old-version-of-renamed-item branch June 1, 2023 18:33
davisagli added a commit that referenced this pull request Aug 21, 2023
* Skip next/previous info for old versions if it can't be obtained

* changelog

* make it fully backwards compatible
davisagli added a commit that referenced this pull request Sep 4, 2023
…) (#1681)

* Skip next/previous info for old versions if it can't be obtained

* changelog

* make it fully backwards compatible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

History endpoint returns internal server error when id changed
5 participants