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

Pre-populate sort title in edit book form if not provided #2948

Merged
merged 2 commits into from
Sep 2, 2023

Conversation

mouse-reeve
Copy link
Member

@mouse-reeve mouse-reeve commented Aug 7, 2023

It's confusing to edit a book when this isn't set, so this provides the best-guess version of the sort title if there isn't one provided, and allows the user to change it as needed.

Fixes #2944

It's confusing to edit a book when this isn't set, so this provides the
best-guess version of the sort title if there isn't one provided, and
allows the user to change it as needed.
@mouse-reeve
Copy link
Member Author

@bookwyrm-social/code-review I think this one is also pretty straightforward, if a little weird to test. On bookwyrm.social, I ended up skipping the migration that populated default sort titles, so this issue is specific to that instance. It's a little hard to replicate it because if you save a book with a blank sort title, one is populated by the save function. You can comment that out, or use models.Edition.objects.filter(id=<book_id>).update(sort_title=None) to update the field without triggering the save function.

Copy link
Contributor

@hughrun hughrun left a comment

Choose a reason for hiding this comment

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

Seems to work as expected, I can't see any obvious problems other than we are checking for null values inside a check for null values.

bookwyrm/models/book.py Show resolved Hide resolved
@mouse-reeve mouse-reeve merged commit c2196fb into main Sep 2, 2023
10 checks passed
@mouse-reeve mouse-reeve deleted the populate-sort-title branch September 2, 2023 00:01
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.

Save-button seems unresponsive when adding a book in Firefox for Android when no sort title is given
2 participants