-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix web book toast message not matching the web book read #9663
Fix web book toast message not matching the web book read #9663
Conversation
a4b93b0
to
8d930d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! One awkward potential change... This code's arch is a little difficult unfortunately! I'm not sure if there's a way we can simplify it rn. Thank you for trudging through it!
604ba3c
to
b3fb885
Compare
This commit stops non-DirectProvider web books from being matched as `DirectProvider`s. The `Storage` objects that ultimately come from `SearchResponse` have `Acquisition` objects in their `providers` fields, so every web book search result will have a `providers` attribute. This commit limits the matching for `DirectProvider` to cases where the `Acquisition` object has a value other than `None`, which is the default initialization value for `Acquisition.provider_name`. More exploration will be needed to see whether a similar mis-match problem occurs when there is more than one `Acquisition` per `Work`.
The `direct_read_button.html` needs a unique `data-toast-trigger` per domain, otherwise every `DirectProvider` book, when multiple are displayed from different providers, will have trigger the same class id.
Co-authored-by: Drini Cami <cdrini@gmail.com>
bafeb9a
to
04708e6
Compare
04708e6
to
d6c8001
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! Tested IA-only, format: web book, publisher:librivox and all looking good 👍
Closes #9639
This PR stops non-DirectProvider web books from being matched as
DirectProvider
s.It also stops every
DirectProvider
book on a page from triggering the same toast message.Technical
With respect to the first issue:
The
Storage
objects that ultimately come fromSearchResponse
haveAcquisition
objects in theirproviders
fields, so every web book search result will have aproviders
attribute.This PR limits the matching for
DirectProvider
to cases where theAcquisition
object has a value other thanNone
, which is the default initialization value forAcquisition.provider_name
.More exploration will be needed to see whether a similar mis-match problem occurs when there is more than one
Acquisition
perWork
.With respect to the second issue:
The
direct_read_button.html
needs a uniquedata-toast-trigger
per domain, otherwise everyDirectProvider
book, when multiple are displayed from different providers, will have trigger the same class id.Testing
Visit https://testing.openlibrary.org/search?q=format%3A%22Web+book%22&mode=everything&page=2
Screenshot
Stakeholders