Skip to content

Commit c9ab4f4

Browse files
committed
fix: filter out excluded notification agents from user preferences
The webhook notification field was inconsistently showing up for some users despite being excluded in the backend. This was happening because the frontend was displaying all notification preferences without filtering out the excluded agents. Changes: - Added excludedAgents array to match backend's excluded notification types - Filter notification preferences in both edit and create user flows - Prevents webhook, email, and mobile notification fields from appearing in user preferences This change aligns the frontend behavior with the backend's intended design where webhook notifications are managed globally rather than per-user. Fixes #5196
1 parent acb679f commit c9ab4f4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ export class UserManagementUserComponent implements OnInit {
3737
private appUrl: string = this.customizationFacade.appUrl();
3838
private accessToken: string;
3939

40+
// List of excluded notification agents that should not be shown in user preferences
41+
private readonly excludedAgents = [
42+
INotificationAgent.Email,
43+
INotificationAgent.Mobile,
44+
INotificationAgent.Webhook
45+
];
46+
4047
constructor(private identityService: IdentityService,
4148
private notificationService: MessageService,
4249
private router: Router,
@@ -74,9 +81,15 @@ export class UserManagementUserComponent implements OnInit {
7481
}
7582
});
7683
if(this.edit) {
77-
this.identityService.getNotificationPreferencesForUser(this.userId).subscribe(x => this.notificationPreferences = x);
84+
this.identityService.getNotificationPreferencesForUser(this.userId).subscribe(x => {
85+
// Filter out excluded notification agents
86+
this.notificationPreferences = x.filter(pref => !this.excludedAgents.includes(pref.agent));
87+
});
7888
} else {
79-
this.identityService.getNotificationPreferences().subscribe(x => this.notificationPreferences = x);
89+
this.identityService.getNotificationPreferences().subscribe(x => {
90+
// Filter out excluded notification agents
91+
this.notificationPreferences = x.filter(pref => !this.excludedAgents.includes(pref.agent));
92+
});
8093
}
8194
this.sonarrService.getQualityProfilesWithoutSettings().subscribe(x => {
8295
this.sonarrQualities = x;

0 commit comments

Comments
 (0)