Skip to content

AO3-6726 Separate languages table into work languages and locale languages#5923

Open
pmonfort wants to merge 5 commits into
otwcode:masterfrom
pmonfort:AO3-6726
Open

AO3-6726 Separate languages table into work languages and locale languages#5923
pmonfort wants to merge 5 commits into
otwcode:masterfrom
pmonfort:AO3-6726

Conversation

@pmonfort

@pmonfort pmonfort commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Pull Request Checklist

Issue

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

Purpose

Separates the languages table, currently used for both works and admin/i18n features, into two independent tables:

  • languages — used exclusively for works
  • locale_languages — used for admin/i18n: locales, admin posts, admin post tags, abuse reports, and support/feedback forms

What this PR does:

  1. Creates the locale_languages table by cloning the existing languages tablATE TABLE ... LIKE+INSERT INTO ... SELECT), preserving IDs so existing language_id` foreign keys work without data migration.
  2. Updates associations on Locale, AdminPost, and AdminPostTag to belongsign_key: :language_id, reusing the existing FK column to avoid data migrations on those tables (per redsummernight's suggestion on related PR. Also removes an orphaned belongs_to :language from ArchiveFaq (no FK existed in the table).
  3. Updates views for abuse reports, support/feedback forms, admin posts, and locanguageinstead ofLanguage. The abuse report and feedback controllers now query LocaleLanguage` for available support languages (the models store language as a str
  4. Adds admin management for locale languages (index, new, create, edit, update)ndit policy (role-based permitted attributes), views, routes, and i18n keys. Adds a "Languages" dropdown to the admin nav with links to "Work Languages" and "Locale Lan
  5. Removes "Support available" and "Abuse support available" checkboxes from thee those fields now belong to locale languages. The columns remain in the languages table but are no longer exposed through the UI or policy.
  6. Restricts work language creation/editing to support and superadmin roles available to translation). The work languages index remains public (no authorization on index).
  7. Adds a fallback rake task (rake After:populate_locale_languages_table) to rfrom languages if needed after deploy. The migration already copies the data; this task is only needed if the migration data needs to be re-synced.

LanguagePolicy changes:

  • create? and update? restricted to support and superadmin (previously also and policy_and_abuse)
  • Permitted attributes limited to name, short, sortable_name (no more support/

LocaleLanguagePolicy roles:

  • index?: translation, support, superadmin, policy_and_abuse
  • create?: translation, superadmin
  • update?: translation, superadmin, support, policy_and_abuse (with role-ses: support can only edit support_available, policy_and_abuse can only edit abuse_support_available)

Testing Instructions

Testing instructions are in the Jira issue.

References

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 8, 2026
@pmonfort
pmonfort force-pushed the AO3-6726 branch 2 times, most recently from 7f7588f to b692618 Compare July 8, 2026 02:58
@pmonfort

Copy link
Copy Markdown
Contributor Author

The failing tests appear to be unrelated to this update, they could be pre-existing flaky tests. Could someone trigger a re-run to make sure?

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