Skip to content

AO3-7156 Add scheduled task to delete unused admin post tags#5941

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

AO3-7156 Add scheduled task to delete unused admin post tags#5941
pmonfort wants to merge 1 commit into
otwcode:masterfrom
pmonfort:AO3-7156

Conversation

@pmonfort

Copy link
Copy Markdown
Contributor

Pull Request Checklist

Issue

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

Purpose

Adds a weekly scheduled Resque job that automatically deletes admin post tags not used on any admin post. The logic is extracted into AdminPostTag.delete_unused, which the existing rake task (Tag:delete_unused_admin_post_tags) now delegates to as well.

Testing Instructions

  1. Create some admin post tags (via admin posts in the admin panel)
  2. Remove the tags from the posts so they become unused
  3. Run rake Tag:delete_unused_admin_post_tags from the console
  4. Verify that only unused tags are deleted

References

The existing rake task used raw SQL for the LEFT JOIN. This PR replaces it with left_outer_joins, which is more idiomatic Rails.

Credit

Pablo Monfort (he/him)

@pmonfort
pmonfort marked this pull request as ready for review July 21, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant