From c01c075984102b4beb18e3503013fcff44a7f5f1 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 29 Jul 2021 18:22:35 +0300 Subject: [PATCH] UI: Refactoring mail-server form --- .../app/modules/home/pages/admin/mail-server.component.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/admin/mail-server.component.ts b/ui-ngx/src/app/modules/home/pages/admin/mail-server.component.ts index 323b591bc4..fd4f5a871e 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/mail-server.component.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/mail-server.component.ts @@ -25,7 +25,7 @@ import { AdminService } from '@core/http/admin.service'; import { ActionNotificationShow } from '@core/notification/notification.actions'; import { TranslateService } from '@ngx-translate/core'; import { HasConfirmForm } from '@core/guards/confirm-on-exit.guard'; -import { isString } from '@core/utils'; +import { deepClone, isString } from '@core/utils'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @@ -148,9 +148,10 @@ export class MailServerComponent extends PageComponent implements OnInit, OnDest this.adminService.saveAdminSettings(this.adminSettings).subscribe( (adminSettings) => { adminSettings.jsonValue.password = this.mailSettings.value.password; - adminSettings.jsonValue.changePassword = this.mailSettings.value.changePassword; this.adminSettings = adminSettings; - this.mailSettings.reset(this.adminSettings.jsonValue); + const formSettings = deepClone(this.adminSettings.jsonValue); + formSettings.changePassword = this.mailSettings.get('changePassword').value || this.isDemo; + this.mailSettings.reset(formSettings, {emitEvent: false}); } ); }