openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Fix flash message when books are edited

Open Amara777 opened this issue 7 months ago • 3 comments

Closes #10674

This PR fixes the flash message when books are edited, changing the copy to "Thank you for improving the Open Library catalog!", as well as fixing the previous pull request that accidentally incorporated many unrelated changes.

Technical

1: In messages.html, flash_book_added, flash_book_updated, and flash_work_updated were deleted/condensed into the variable flash_catalog_updated , which returns = "Thank you very much for improving that record!"

2: In addbook.py, the variable flash_catalog_updated is used to address both adding and editing, and instances of the previous three variables (flash_book_added, flash_book_updated, and flash_work_updated) are changed to flash_catalog_updated.

2: (Breakdown) The error may have been occurring due to how revision = 1 in the variable add's logic. I noticed that the first time an edit is made, the incorrect flash message ("Thank you very much for adding that new book!") would show, but all subsequent edits would receive the correct flash message ("Thank you very much for improving that record!"). Revision is still = 1 when the first edit is made, making add = True.

Book is created in catalog → revision = 1 First edit is made → revision is still = 1 → add = True After the first edit, revision increments to 2 Second edit is made → revision is still = 2 → second edit is correctly identified as an "edit"

Testing

1: Edit an edition that has a "Read" button 2: Read the flash message Expected behavior: Flash message reads: "Thank you for improving the Open Library catalog!"

Screenshot

Screenshot 2025-04-22 at 10 04 27 PM

Stakeholders

@jimchamp

Amara777 avatar Jun 01 '25 01:06 Amara777

Any updates, @Amara777?

jimchamp avatar Jun 09 '25 17:06 jimchamp

Hi @jimchamp yes, I can make those changes by EOD, thank you for the additional context

Amara777 avatar Jun 09 '25 22:06 Amara777

Hi, I made the additional changes, please let me know if anything else needs to be fixed! I can also be reached over slack if needed.

Amara777 avatar Jun 09 '25 23:06 Amara777

Hi @jimchamp thanks for all of your help, I merged your PR into this branch I believe. Is there anything further that should be adjusted?

Amara777 avatar Jul 12 '25 22:07 Amara777