Skip to content

Conversation

jimchamp
Copy link
Collaborator

@jimchamp jimchamp commented Sep 18, 2025

Closes #11256

Adds new safe_mode keyword parameter to all query carousel templates. If safe_mode is true, the query that is used to populate the carousel is updated to avoid fetching items with potentially objectionable covers.

Data Source How does the query change when safe_mode is true
Solr -subject:"content_warning:cover" is appended to the query
advancedsearch.php AND !collection:(no-preview) is appended to the query

Technical

Testing

Screenshot

Stakeholders

@Copilot Copilot AI review requested due to automatic review settings September 18, 2025 21:13
@github-actions github-actions bot added the Priority: 1 Do this week, receiving emails, time sensitive, . [managed] label Sep 18, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a "safe mode" feature for carousel templates to filter out books with potentially objectionable covers by adding a new safe_mode parameter that defaults to True across all carousel-related functions and templates.

  • Adds safe_mode parameter with True default to all carousel templates and functions
  • Modifies query generation to exclude content with warning tags when safe mode is enabled
  • Updates both Solr and advancedsearch.php query logic to filter objectionable content

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
openlibrary/templates/home/custom_ia_carousel.html Adds safe_mode parameter and passes it to URL composition and carousel generation
openlibrary/plugins/openlibrary/partials.py Enables safe_mode by default in browse query functionality
openlibrary/plugins/openlibrary/home.py Adds safe_mode parameter to carousel book retrieval functions
openlibrary/macros/RawQueryCarousel.html Implements query modification to exclude content warning covers when safe_mode is true
openlibrary/macros/QueryCarousel.html Adds safe_mode parameter and passes it through to RawQueryCarousel
openlibrary/macros/ListCarousel.html Adds safe_mode parameter and forwards it to QueryCarousel
openlibrary/core/lending.py Implements safe_mode logic in URL composition to exclude no-preview collections

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mekarpeles mekarpeles merged commit 10ed6be into internetarchive:master Sep 25, 2025
4 checks passed
@jimchamp jimchamp deleted the carousel-safe-mode branch October 9, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Testing Priority: 1 Do this week, receiving emails, time sensitive, . [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Carousels Safe Again

2 participants