AO3-7536 Expire creator comment caches when creatorships of anonymous work change - #5943
Conversation
|
Hi @Bilka2. Sorry if I shouldn't be tagging you; I saw that you are the reporter of the original Jira ticket and this PR has been sitting for five days and I'm not really sure what I should do next. Could you let me know if you need anything from me? Thank you in advance! |
|
As explained in our contributing guidelines, please be patient with us. Due to our workload, it may take some time before we can review and eventually merge your pull request. As you can tell from the overall pull request list, we have a backlog of about 40 non-draft pull requests awaiting review, some of them as old as April of this year. While we prioritize some pull requests for reviewing and merging, such as the first pull request by each person, generally it may take some time until someone gets to them. |
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