[US-2.4 / OBT-264] Reactivate a deactivated language - #121
Open
levigtri wants to merge 2 commits into
Conversation
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>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: QUIET Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
US-2.1 / #97 made language deletion a soft-delete (
is_active = False) gated behindrequire_platform_admin, but left no way back. This adds the inverse operation, mirroringdeactivate_languageexactly.reactivate_language(app/services/language/reactivate_language.py): platform-admin-only, setsis_active = True,get_language_or_404→NotFoundError,AuthorizationErrorfor non-admins. Idempotent (never inspects the current flag, same as deactivate).POST /api/languages/{language_id}/reactivate→200withLanguageResponse, guarded byrequire_platform_admin.language_service.No Alembic migration —
Language.is_activealready exists on the base branch (introduced by #97).Stacked on #97 — merge order
This branch is stacked on
levigft/obt-200-us-21-...(#97), becausereactivate_languagemirrorsdeactivate_languageand reusesLanguage.is_active, both of which are introduced there. Same arrangement as #90.Merge #97 before this PR. GitHub retargets this PR to
mainautomatically once #97 lands.Test plan
uv run pytest tests/test_language_service.py tests/test_language_api.pytests/test_language_service.py): admin reactivates an inactive language → active; non-admin →403; missing →404; reactivated row reappears in the defaultlist_languages; reactivating an already-active language is a no-op.tests/test_language_api.py, new): adminPOST …/reactivate→200withis_active: true; authenticated non-admin →403(exercises therequire_platform_admindependency, not just the service guard); missing id →404.All green (ruff + mypy clean;
tests/is excluded from mypy perpyproject.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.