AO3-7536 Expire creator comment caches when creatorships of anonymous work change#5943
Open
hab-bang wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
AO3-1234 Fix thing)until they are reviewed and merged before creating new pull requests.
Issue
https://otwarchive.atlassian.net/browse/AO3-7536
Purpose
Expiring the cached comment bylines when the creatorships of an anonymous work (a work in an anonymous collection) change, so comments by the affected user start or stop displaying as "Anonymous Creator" correctly.
As described in the Jira ticket, AO3-3712 (#1289) added cache busting for creator comments when a work is added to or removed from an anonymous collection, but there was no such thing for creatorship changes on a work that stays anonymous. So when a creator removed themselves via "Remove Me As Co-Creator" (or was re-added and accepted), their comments kept showing the wrong byline until the 1-week fragment cache expired.
This PR adds a
Creatorshipcallback that enqueues a newWork#poke_cached_creator_comments_for_user, touching the affected user's comments on the work so their bylines re-render. The existingWork#poke_cached_creator_commentscould not be reused here: it looks up the work's current creators, and a removed creator has already left that list by the time the background job runs so that their comments would be the ones skipped. Passing the user's id captured at the moment the creatorship changes covers both removal and re-adding.The added feature scenario fails without the
CreatorshipandWorkchanges, and passes with them.Testing Instructions
Follow the reproduction steps on the Jira issue (post a work with a co-creator into an anonymous collection, comment as a creator, then remove yourself via Edit => "Remove Me As Co-Creator"):
Reproducing locally requires fragment caching to be enabled (
rails dev:cache) and a Resque worker running.You can also see the testing instructions are also on the Jira ticket.
References
AO3-3712 (https://otwarchive.atlassian.net/browse/AO3-3712, #1289) introduced the equivalent cache busting for collection-anonymity changes; this PR follows the same pattern for creatorship changes and reuses its touch-based invalidation approach.
Credit
Name: hayoung
Pronouns: she/her