Skip to content

fix: surface activation/deactivation failures instead of reporting success - #163

Merged
vishwab1 merged 1 commit into
release-3.8.4from
sn/3.8.4-fix-user-activation
Sep 11, 2026
Merged

fix: surface activation/deactivation failures instead of reporting success#163
vishwab1 merged 1 commit into
release-3.8.4from
sn/3.8.4-fix-user-activation

Conversation

@snehar-nd

Copy link
Copy Markdown
Contributor

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.

OutputResponse returns HTTP 200 with {statusCode: 5000, errorMessage} on failure, and the global interceptor only special-cases statusCode === 5002 (session expiry). So an API-level failure flows into the success callback:

(res) => {
  this.dialogService.alert(this.confirmMessage + 'd successfully', 'success');  // fires on failure too
  this.getAllUserDetails();
},
(err) => console.log('error', err),   // user sees nothing

Fix

  • Success callback checks statusCode before alerting, and surfaces errorMessage when the call failed.
  • Error callback raises the message instead of only logging it.

Scope

Only the userActivationDeactivation subscribe in activateDeactivate(). 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 --fix clean 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

…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>
@coderabbitai

coderabbitai Bot commented Sep 11, 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: CHILL

Plan: Advanced

Run ID: 4a81a0dc-513a-45fa-838c-cacff8bd15f4

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

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.

❤️ Share

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

@sonarqubecloud

Copy link
Copy Markdown

@vishwab1
vishwab1 merged commit 115d843 into release-3.8.4 Sep 11, 2026
4 checks passed
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.

2 participants