From c9ab4f4f9faa66dbf263da693db1eefcf68beeec Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 14 May 2025 22:16:34 +0100 Subject: [PATCH] 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 --- .../usermanagement-user.component.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts index 1110490b9..a2e1872f9 100644 --- a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts +++ b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts @@ -37,6 +37,13 @@ export class UserManagementUserComponent implements OnInit { private appUrl: string = this.customizationFacade.appUrl(); private accessToken: string; + // List of excluded notification agents that should not be shown in user preferences + private readonly excludedAgents = [ + INotificationAgent.Email, + INotificationAgent.Mobile, + INotificationAgent.Webhook + ]; + constructor(private identityService: IdentityService, private notificationService: MessageService, private router: Router, @@ -74,9 +81,15 @@ export class UserManagementUserComponent implements OnInit { } }); if(this.edit) { - this.identityService.getNotificationPreferencesForUser(this.userId).subscribe(x => this.notificationPreferences = x); + this.identityService.getNotificationPreferencesForUser(this.userId).subscribe(x => { + // Filter out excluded notification agents + this.notificationPreferences = x.filter(pref => !this.excludedAgents.includes(pref.agent)); + }); } else { - this.identityService.getNotificationPreferences().subscribe(x => this.notificationPreferences = x); + this.identityService.getNotificationPreferences().subscribe(x => { + // Filter out excluded notification agents + this.notificationPreferences = x.filter(pref => !this.excludedAgents.includes(pref.agent)); + }); } this.sonarrService.getQualityProfilesWithoutSettings().subscribe(x => { this.sonarrQualities = x;