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

Fix private reading log errors #8918

Merged

Conversation

jimchamp
Copy link
Collaborator

Closes #8917

Avoids error that occurs when a private reading log page is visited.

Also, sets default fall-back value of MyBooksTemplate.counts to an empty dict. This doesn't fix anything, but should give developers an indication, with a cursory glance, that this property is meant to be a dict.

Technical

Today, whenever a private reading log page is visited, the default mb.counts value is an empty list. The reading log view handler attempts to set the values of KEYS_TITLES by accessing mb.counts with a key, which causes an error when mb.counts is a list. The PR sets KEYS_VALUES inside of the conditional that checks if the page is viewable, avoiding the error altogether.

Testing

  1. Open a private browser window, and navigate to a private reading log page. Ensure that you are redirected to the expected profile page.
  2. Navigate to a public reading log page. Ensure that the expected reading log page is rendered without error.

Screenshot

Stakeholders

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.

Might be best to pull the raise to the top and flip the if statement. That makes it into the common "bail early" pattern which we tend to use a lot. Otherwise tested on testing and lgtm!

@cdrini cdrini self-assigned this Mar 22, 2024
@cdrini cdrini added the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Mar 22, 2024
@mekarpeles mekarpeles assigned mekarpeles and unassigned cdrini Mar 25, 2024
@mekarpeles mekarpeles added the Priority: 1 Do this week, receiving emails, time sensitive, . [managed] label Apr 1, 2024
Copy link
Member

@mekarpeles mekarpeles left a comment

Choose a reason for hiding this comment

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

tested, works!

@mekarpeles mekarpeles merged commit 5630324 into internetarchive:master Apr 4, 2024
3 checks passed
@jimchamp jimchamp deleted the bug/fix-private-reading-log-errors branch April 24, 2024 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing Priority: 1 Do this week, receiving emails, time sensitive, . [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Navigating to a private reading log shelf results in an error page
3 participants