diff --git a/frontend/projects/shared-meet-components/src/lib/pages/console/developers/developers.component.html b/frontend/projects/shared-meet-components/src/lib/pages/console/developers/developers.component.html index f15bfbf..f61ccdd 100644 --- a/frontend/projects/shared-meet-components/src/lib/pages/console/developers/developers.component.html +++ b/frontend/projects/shared-meet-components/src/lib/pages/console/developers/developers.component.html @@ -181,7 +181,7 @@ diff --git a/frontend/projects/shared-meet-components/src/lib/pages/console/users-permissions/users-permissions.component.ts b/frontend/projects/shared-meet-components/src/lib/pages/console/users-permissions/users-permissions.component.ts index 5722cfd..ae10f5b 100644 --- a/frontend/projects/shared-meet-components/src/lib/pages/console/users-permissions/users-permissions.component.ts +++ b/frontend/projects/shared-meet-components/src/lib/pages/console/users-permissions/users-permissions.component.ts @@ -32,6 +32,7 @@ import { AuthMode } from '@lib/typings/ce'; }) export class UsersPermissionsComponent implements OnInit { isLoading = signal(true); + hasAccessSettingsChanges = signal(false); adminCredentialsForm = new FormGroup({ adminUsername: new FormControl({ value: '', disabled: true }, [Validators.required]), @@ -48,11 +49,18 @@ export class UsersPermissionsComponent implements OnInit { { value: AuthMode.ALL_USERS, label: 'Everyone' } ]; + private initialAccessSettingsFormValue: any = null; + constructor( private preferencesService: GlobalPreferencesService, private authService: AuthService, private notificationService: NotificationService - ) {} + ) { + // Track form changes + this.accessSettingsForm.valueChanges.subscribe(() => { + this.checkForAccessSettingsChanges(); + }); + } async ngOnInit() { this.isLoading.set(true); @@ -76,12 +84,26 @@ export class UsersPermissionsComponent implements OnInit { try { const authMode = await this.preferencesService.getAuthModeToAccessRoom(); this.accessSettingsForm.get('authModeToAccessRoom')?.setValue(authMode); + + // Store initial values after loading + this.initialAccessSettingsFormValue = this.accessSettingsForm.value; + this.hasAccessSettingsChanges.set(false); } catch (error) { console.error('Error loading security preferences:', error); this.notificationService.showSnackbar('Failed to load security preferences'); } } + private checkForAccessSettingsChanges() { + if (!this.initialAccessSettingsFormValue) { + return; + } + + const currentValue = this.accessSettingsForm.value; + const hasChanges = JSON.stringify(currentValue) !== JSON.stringify(this.initialAccessSettingsFormValue); + this.hasAccessSettingsChanges.set(hasChanges); + } + async onSaveAdminCredentials() { if (this.adminCredentialsForm.invalid) { return; @@ -112,6 +134,10 @@ export class UsersPermissionsComponent implements OnInit { await this.preferencesService.saveSecurityPreferences(securityPrefs); this.notificationService.showSnackbar('Access & Permissions settings saved successfully'); + + // Update initial values after successful save + this.initialAccessSettingsFormValue = this.accessSettingsForm.value; + this.hasAccessSettingsChanges.set(false); } catch (error) { console.error('Error saving access permissions:', error); this.notificationService.showSnackbar('Failed to save Access & Permissions settings'); diff --git a/frontend/projects/shared-meet-components/src/lib/services/global-preferences.service.ts b/frontend/projects/shared-meet-components/src/lib/services/global-preferences.service.ts index c7d9a77..9b20293 100644 --- a/frontend/projects/shared-meet-components/src/lib/services/global-preferences.service.ts +++ b/frontend/projects/shared-meet-components/src/lib/services/global-preferences.service.ts @@ -65,7 +65,14 @@ export class GlobalPreferencesService { async saveWebhookPreferences(preferences: WebhookPreferences) { const path = `${this.PREFERENCES_API}/webhooks`; await this.httpService.putRequest(path, preferences); - this.webhookPreferences = preferences; + + // Only update fields that are explicitly provided + if (this.webhookPreferences) { + this.webhookPreferences.enabled = preferences.enabled; + if (preferences.url) { + this.webhookPreferences.url = preferences.url; + } + } } async testWebhookUrl(url: string): Promise {