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

Add to Want to Read list button enabled for registered users #10343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

schu96
Copy link
Contributor

@schu96 schu96 commented Jan 16, 2025

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

  1. Sign in using the OpenLibrary admin account, empty the 'Want to Read' list if books already exist within the list.

  2. Acquire the ISBN barcodes or ISBN numbers that are within the OL dev database for the barcode scanner.

  3. 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.

  4. 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.

    • Refresh the barcode scanner page, enable the 'Add to my Want to Read list' button, and scan the barcodes again. There should be no changes to the 'Want to Read' list.
  5. 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' list

    • The fetch request to add the book to the WtR reading log requires the work id gotten within the LazyBookCard component. Not sure how to make submitISBN await the add to WtR fetch request since that function is bound to submitISBNThrottled. Open to suggestions on how to handle this situation if this isn't ideal behavior
  6. Sign 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

@github-actions github-actions bot added the Priority: 2 Important, as time permits. [managed] label Jan 16, 2025
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 17.59%. Comparing base (3025f5d) to head (5c7a187).
Report is 219 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10343      +/-   ##
==========================================
+ Coverage   17.44%   17.59%   +0.15%     
==========================================
  Files          89       87       -2     
  Lines        4792     4768      -24     
  Branches      848      847       -1     
==========================================
+ Hits          836      839       +3     
+ Misses       3436     3410      -26     
+ Partials      520      519       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 2 Important, as time permits. [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Barcodescanner should have a "Add to list" button
3 participants