fix: surface activation/deactivation failures instead of reporting success - #163
Conversation
…ccess OutputResponse returns HTTP 200 with statusCode 5000 on failure, and the global interceptor only special-cases 5002 (session expiry), so an API-level failure reached the success callback. Clicking Activate on a user the backend could not update showed "Activated successfully", then refreshed the list with the user still deactivated -- the failure was only ever visible in the browser console. The success callback now checks statusCode before alerting, and the error callback raises the message instead of just logging it. Co-Authored-By: Claude Opus 5 (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: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Problem
When Activate fails, the UI reports "Activated successfully" and then refreshes the list with the user still deactivated. The real error only ever reached the browser console.
OutputResponsereturns HTTP 200 with{statusCode: 5000, errorMessage}on failure, and the global interceptor only special-casesstatusCode === 5002(session expiry). So an API-level failure flows into the success callback:Fix
statusCodebefore alerting, and surfaceserrorMessagewhen the call failed.Scope
Only the
userActivationDeactivationsubscribe inactivateDeactivate(). No change to the request, the confirm dialog, or the refresh-on-success behaviour.What this does and doesn't do
This is error visibility, not the functional fix — on its own it won't make Activate work, it will make the failure legible. The activation failure itself is fixed in the companion PR, PSMRI/Admin-API#149 (an unguarded NPE in
deletedUserDetails). Both are worth having: the swallowed error is what let this go undiagnosed, and it would hide the next failure too.Independent of the backend PR; merge order doesn't matter.
Deliberately not included
The Activate button is gated
*ngIf="!element.lockedDueToFailedAttempts && element.deleted === true", so a user who is both locked and deactivated gets no Activate button at all — they must be unlocked first. That may well be the intended flow (the Lock column's disabled state says "Activate the account before changing lock status"), so it's left alone rather than changed on assumption. Worth a separate decision.Verification status
Prettier and eslint pass (lint-staged ran
eslint --fixclean on commit). Not run in a browser — the behaviour change is in a callback that needs a real failing API response to exercise.🤖 Generated with Claude Code