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

Hide download options when book is unavailable. #9647

Merged
merged 4 commits into from
Aug 2, 2024
Merged

Hide download options when book is unavailable. #9647

merged 4 commits into from
Aug 2, 2024

Conversation

shubhiscoding
Copy link
Contributor

Closes #9637

Added extra check before rendering download option to avoid it's visibility when the book is not present in Internet Archive

Technical

add same condition that was used to check if read button should be called in LoanStatus.html
(availability.get('is_readable') or availability.get('status') == 'open')

Assuming that If a book is no longer available on Internet Archive then it would be Not be readable anyways.

Testing

Create a Book, search for the book by it's name and open it, by default it shows Not In Library, and you'll see that Download Options are not visible, while If you open any of the other Book which are available you'll be able to see Download options.

Screenshot

Available Book

Screenshot from 2024-07-29 06-22-00

Unavailable Book

Screenshot from 2024-07-29 06-22-54

Stakeholders

@scottbarnes

Co-authored-by: Scott Barnes <scottreidbarnes@gmail.com>
@shubhiscoding
Copy link
Contributor Author

Hey @scottbarnes I tried finding some other fix, but I'm getting nowhere, have you got some leads or suggestion?

@scottbarnes
Copy link
Collaborator

@shubhiscoding, this looks good so far. I will try to review and possibly merge it tomorrow, but I have not set aside time to figure out all the test conditions we need. Currently I can't think of anything better, and if you can't also, then this may be the best way to do it. :)

Extra space was breaking the template.
Use () to properly group the `or` conditions.
Copy link
Collaborator

@scottbarnes scottbarnes left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, @shubhiscoding!

@scottbarnes scottbarnes merged commit 04fb777 into internetarchive:master Aug 2, 2024
4 checks passed
Souvik-Cyclic pushed a commit to Souvik-Cyclic/openlibrary that referenced this pull request Aug 17, 2024
* Hide download options when book is unavailable.
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.

Download options appear for Editions with a 'bad' OCAID
2 participants