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

Check for work key before rendering list showcase #8982

Conversation

jimchamp
Copy link
Collaborator

@jimchamp jimchamp commented Mar 27, 2024

Closes #8983

Checks for a work key before rendering the work list showcase on book pages.

Technical

On orphaned edition book pages, an IndexError was being thrown by the get_seed_info call in lists/widget.html, here. In these cases, a dummy Work object, which has an empty string as its key, is passed to get_seed_info, which requires a Thing with a non-empty string to function correctly.

Since the dummy work object is truthy, we also have to check for a work.key before rendering the work list showcase.

Testing

  1. Visit an orphaned edition's book page. Ensure that there are no error messages rendered on the page ("Lists" section and flash message).
  2. Visit a work's book page and a non-orphaned edition's book page. Confirm that these are rendering without error.

Screenshot

Stakeholders

@jimchamp jimchamp added the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Mar 27, 2024
@jimchamp jimchamp changed the title [WIP] Check for work key before rendering list showcase Check for work key before rendering list showcase Mar 27, 2024
@jimchamp jimchamp marked this pull request as ready for review March 27, 2024 23:19
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

@cdrini cdrini merged commit 446dd99 into internetarchive:master Mar 27, 2024
3 checks passed
@cdrini cdrini self-assigned this Mar 27, 2024
@jimchamp jimchamp removed the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Apr 2, 2024
@jimchamp jimchamp deleted the bug/fix-orphaned-edition-list-widget-error-on-book-page branch April 24, 2024 00:03
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.

Books Page: List widget fails to render for orphaned editions
2 participants