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, FAQs, abuse reports, and support/feedback forms

What this PR does:

  1. Creates the locale_languages table duplicating the existing languages data, including indexes.
  2. Updates associations on Locale, AdminPost, and ArchiveFaq to belongs_to :locale_language, foreign_key: :language_id , reusing the existing FK column to avoid data migrations on those tables (per redsummernight's suggestion on related PR).
  3. Updates views for abuse reports, support/feedback forms, admin posts, and locales to reference LocaleLanguage instead of Language.
  4. Adds full admin CRUD for locale languages with a new controller, Pundit policy (role-based permitted attributes), views, routes, and i18n keys.
  5. Removes "Support available" and "Abuse support available" checkboxes from the work languages form, since those fields now belong to locale languages.
  6. Restricts work language creation/editing to support and superadmin roles only (was previously also available to translation).
  7. Adds a rake task (rake After:populate_locale_languages) to populate the new table, following the project's after_tasks pattern.

Changes to LanguagePolicy:

  • index? now allows translation, support, superadmin, and policy_and_abuse (read-only access)
  • create? and update? restricted to support and superadmin
  • Permitted attributes limited to name, short, sortable_name (no more support/abuse fields)

LocaleLanguagePolicy roles:

  • index? and edit?: translation, support, superadmin, policy_and_abuse
  • create?: translation, superadmin
  • update?: translation, superadmin, support, policy_and_abuse (with role-specific permitted attributes)

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