Add to Want to Read list button enabled for registered users #10343
+62
−5
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.
Closes #4728
Thought it would be good to start with just the Want to Read reading log before expanding this to user lists. If 'Add to Want to Read list' is enabled, scanned books won't automatically redirect to their OL page until the feature is disabled again.
Feature
Technical
Allow signed in users to add scanned books to their Want to Read list.
Button is disabled for barcode scanner users that are not logged into their OL account.
Prevents books that are already present in the WtR list from being removed with the
dont_remove
POST body argument.Testing
Sign in using the OpenLibrary admin account, empty the 'Want to Read' list if books already exist within the list.
Acquire the ISBN barcodes or ISBN numbers that are within the OL dev database for the barcode scanner.
Navigate to
http://localhost:8080/barcodescanner
, enable your device's camera permissions within the settings menu and click on the 'Add to my Want to Read List'. The subtext should say 'Currently enabled' when the feature is active.Scan the ISBN barcodes or use the text ISBN feature, the LazyBookCard components should appear at the bottom. Go back to the WtR list and verify that the scanned books are present in the list.
Navigate to
http://localhost:8080/barcodescanner?returnTo=/isbn/$$$
, enable 'Add to my Want to Read List' and scan an ISBN. The intended behavior to navigate the user to the work's OL page is disabled in favor of adding the book to the 'Want to Read' listLazyBookCard
component. Not sure how to makesubmitISBN
await the add to WtR fetch request since that function is bound tosubmitISBNThrottled
. Open to suggestions on how to handle this situation if this isn't ideal behaviorSign out of the OpenLibrary account and view the barcode scanner page again. Add to my Want to Read list should be disabled and contain the subtext 'You must be signed in to enable this feature'
Screenshot
2025-01-16.02-06-50.mp4
Stakeholders
@cdrini @mekarpeles