internetarchive / internetarchive/openlibrary

Carousels don't follow merged work redirects

Open
#5,729 1 comment 1 reaction 0 assignees View on GitHub
Affects: Librarians Lead: @cdrini Priority: 2 Theme: Redirects Type: Bug
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 19h
Merged PRs (30d)
138

Description

When QueryCarousels are set by a list of explicit ids, the carousel macro will silently drop a work that has been merged.

### Evidence / Screenshot (if possible)

Here's an [example collection page with the single carousel showing the problem](https://openlibrary.org/collections/test-follow-merged-works), which might be helpful for testing.

The carousel on that page should contain four works called explicitly by work id:

[OL58400W](https://openlibrary.org/works/OL58400W) - Dinotopia: A Land Apart From Time
[OL14935262W](https://openlibrary.org/works/OL14935262W) - Dinotopia: World Beneath (before merging)
[OL19650750W](https://openlibrary.org/works/OL19650750W) - Dinotopia: Journey to Chandara
[OL17052360W](https://openlibrary.org/works/OL17052360W) - Dinotopia: First Flight

At some point, The World Beneath work was merged and now redirects correctly to OL9290760W if you click on the work link. However, the carousel silently drops this work that has been merged. I would expect it to follow the redirect, and use the cover image and link of the new work.

This is the query:

`{{QueryCarousel(query="key:(/works/OL58400W OR /works/OL14935262W OR /works/OL17052360W OR /works/OL19650750W)", sort="old", title="Original Illustrated Books by James Gurney", has_fulltext_only=False)}}`

This is the carousel:

![carousel](https://user-images.githubusercontent.com/85025703/136051963-a13da04b-fef3-49e9-bcf5-06795ef57f03.png)

### Steps to Reproduce

1. Create a QueryCarousel with a small list of explicit work ids.
2. Merge one of those work ids into another work.
3. Refresh the carousel page.

* Actual: The carousel no longer displayed the merged work, with no warning that the work was missing.
* Expected: The carousel should follow the redirect and display the cover image of the merged work, as well as link to the new work id and reflect the borrowable status of the merged work.

### Details

- **Logged in (Y/N)?** both
- **Browser type/version?** Firefox 91.0.2 for Mint
- **Operating system?** Linux Mint 20
- **Environment (prod/dev/local)?** prod, testing

### Proposal & Constraints

### Related files

### Stakeholders
@libjenner

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.