Fix: Preserve list notes when resolving redirects #11122
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When list items are redirects, the notes were being lost during redirect resolution in get_seeds() method. This fix preserves the original notes by creating an AnnotatedSeed with both the resolved document and the original notes.
What issue does this PR close? - Closes #9600
What does this PR achieve? - fix
Technical
This fixes a bug where list notes disappear when books are redirects. The original code was creating a new
Seedwithout keeping the notes when resolving redirects. My fix saves the original notes first, then creates the newSeedwith both the resolved book and the saved notes.Changed file:
openlibrary/core/lists/model.py(lines 322-330)Testing
I wasn't able to create redirect scenarios in the development environment, but I verified the logic preserves
original_notesbefore redirect resolution and creates an AnnotatedSeed with both the resolved document and original notes.Screenshot
This is a backend fix that doesn't change UI elements directly, but prevents notes from disappearing on list items that are redirects.
Stakeholders
@cdrini