Skip to content

AO3-7135 Record canonized/decanonized dates on tags - #5954

Open
pmonfort wants to merge 1 commit into
otwcode:masterfrom
pmonfort:AO3-7135
Open

AO3-7135 Record canonized/decanonized dates on tags#5954
pmonfort wants to merge 1 commit into
otwcode:masterfrom
pmonfort:AO3-7135

Conversation

@pmonfort

Copy link
Copy Markdown
Contributor

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-7135

Purpose

Adds two new datetime columns (canonized_at and decanonized_at) to the tags table to record when a tag was most recently canonized or decanonized.

  • A before_save callback sets canonized_at when a tag becomes canonical, and decanonized_at when it becomes non-canonical.
  • The tag edit page displays "Last canonized on [datetime] UTC" and "Last decanonized on [datetime] UTC" to admins (superadmin, policy_and_abuse, tag_wrangling), directly below the "last edited" information. Sentences are omitted when the corresponding date is nil.
  • Both fields are indexed in Elasticsearch and exposed as sort options ("Date Canonized", "Date Decanonized") in tag search.

Testing Instructions

  1. Log in as a tag wrangler.
  2. Create a new tag (non-canonical). Edit it, you should not see "Last canonized on" or "Last decanonized on".
  3. Create a new canonical tag. Edit it, you should not see the dates (wranglers don't see them).
  4. Log out.
  5. Log in as an admin with superadmin, policy_and_abuse, or tag_wrangling role.
  6. Edit the non-canonical tag from step 2, you should not see any canonization dates.
  7. Check "Canonical", save, and re-edit, you should see "Last canonized on [datetime] UTC"
  8. Uncheck "Canonical", save, and re-edit, you should see both "Last canonized on" and "Las
  9. Edit the canonical tag from step 3, you should see "Last canonized on [datetime] UTC" on
  10. Find a tag that was canonized before this deployment and decanonize it, it should shotetime] UTC" only (no canonized date since that happened before the migration).
  11. Log out.
  12. Search > Tags, verify "Date Canonized" and "Date Decanonized" appear in the "Sort by" d
  13. Sort by "Date Canonized" descending, recently canonized tags should appear first.
  14. Sort by "Date Decanonized" descending, recently decanonized tags should appear first.

Credit

Pablo Monfort (he/him)

@github-actions github-actions Bot added Has Migrations Contains migrations and therefore needs special attention when deploying Awaiting Review labels Jul 29, 2026
@pmonfort
pmonfort force-pushed the AO3-7135 branch 2 times, most recently from ed85026 to b2c6cf2 Compare July 29, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Awaiting Review Has Migrations Contains migrations and therefore needs special attention when deploying

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant