Fix inconsistencies in "Series Updated" dates

Description

The "Series Updated" date (series.revised_at, used on series blurbs and for the "Date Updated" sort option on bookmark searches) is defined as:

  • max(updated_at) of any visible works; visible = unhidden + posted + (if logged out) unrestricted

  • series.updated_at (when the series's summary/title was last updated), if no works are visible

We should remove the "(if logged out) unrestricted" part because:

  • The search indexer does not have authentication and is effectively a logged out user. This means logged in users can see a discrepancy between the date on the blurb and the date implied by the series position in the bookmark search results. Example: A series have all restricted works. The latest work was edited in 2016, and "Series Updated" on the series blurb agrees. However, the series' title was edited yesterday, the indexer uses {{series.updated_at}} because no works are "visible" to it, so the series is at the top of search results, sorted by "Date Updated".

  • Even if revised_at doesn't take into account the restricted status of works in series, logged out users won't see any inconsistencies, because a series is restricted if any work in it is restricted, and logged out users just don't see restricted series at all.

We should still keep series.updated_at as the fallback for the case where all works in a series are drafts (unposted) or hidden.

How to test: Check that on a bookmark search/listing, sorted by "Date Updated":

  • Adding a new work to a series will bump the series to the top of the list (either logged in or not).

  • Adding a new restricted work to a series will make the series restricted and also bump it to the top of the list.

  • Editing the title of an old series will not bump it to the top of the list (either logged in or not).

  • Editing the title of an old series with all works restricted will not bump it to the top of the list.

Note: We will need to reindex all bookmarked series.

Environment

None

Status

Assignee

Unassigned

Reporter

redsummernight

Roadmap

Series

Priority

Medium

Affects versions

Fix versions

None

Components

BackEnd

Difficulty

Medium

Required Access Level

None

Milestone

Internal 0.9
Configure