Skip to content

[US-2.4 / OBT-264] Reactivate a deactivated language - #121

Open
levigtri wants to merge 2 commits into
levigft/obt-200-us-21-deactivate-a-language-instead-of-permanently-deletingfrom
levigft/obt-264-us-24-reactivate-a-deactivated-language
Open

[US-2.4 / OBT-264] Reactivate a deactivated language#121
levigtri wants to merge 2 commits into
levigft/obt-200-us-21-deactivate-a-language-instead-of-permanently-deletingfrom
levigft/obt-264-us-24-reactivate-a-deactivated-language

Conversation

@levigtri

Copy link
Copy Markdown
Member

Summary

US-2.1 / #97 made language deletion a soft-delete (is_active = False) gated behind require_platform_admin, but left no way back. This adds the inverse operation, mirroring deactivate_language exactly.

  • Service reactivate_language (app/services/language/reactivate_language.py): platform-admin-only, sets is_active = True, get_language_or_404NotFoundError, AuthorizationError for non-admins. Idempotent (never inspects the current flag, same as deactivate).
  • Endpoint POST /api/languages/{language_id}/reactivate200 with LanguageResponse, guarded by require_platform_admin.
  • Exported on language_service.

No Alembic migrationLanguage.is_active already exists on the base branch (introduced by #97).

Stacked on #97 — merge order

This branch is stacked on levigft/obt-200-us-21-... (#97), because reactivate_language mirrors deactivate_language and reuses Language.is_active, both of which are introduced there. Same arrangement as #90.

Merge #97 before this PR. GitHub retargets this PR to main automatically once #97 lands.

Test plan

uv run pytest tests/test_language_service.py tests/test_language_api.py

  • Service (tests/test_language_service.py): admin reactivates an inactive language → active; non-admin → 403; missing → 404; reactivated row reappears in the default list_languages; reactivating an already-active language is a no-op.
  • API (tests/test_language_api.py, new): admin POST …/reactivate200 with is_active: true; authenticated non-admin → 403 (exercises the require_platform_admin dependency, not just the service guard); missing id → 404.

All green (ruff + mypy clean; tests/ is excluded from mypy per pyproject.toml, matching the existing suite).

Frontend counterpart

The console reactivate affordance (a restore action on inactive rows, platform-admin only) plus the darker inactive-row styling ship on the redesign line — tripod-console#40 (OBT-258).

Closes OBT-264.

levigtri and others added 2 commits July 22, 2026 16:04
Add a platform-admin-only POST /languages/{id}/reactivate that flips
is_active back to True, mirroring the deactivate soft-delete. No schema
change: is_active already exists on the base branch.

US-2.4 / OBT-264

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Service-level: admin reactivates an inactive language, non-admin 403,
missing 404, restores default-list visibility, already-active is a
no-op. API-level: 200 with an active body, 403 for a non-admin through
the require_platform_admin gate, and 404 for a missing language.

US-2.4 / OBT-264

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jul 22, 2026

Copy link
Copy Markdown

OBT-264

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Pro Plus

Run ID: 34ce7cc1-ef79-402b-abfe-d2fb1dbca672

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch levigft/obt-264-us-24-reactivate-a-deactivated-language

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant