From 2a2cf3047adacf9857c2fafe8288eacd9f4bf9b2 Mon Sep 17 00:00:00 2001 From: George Date: Tue, 18 Jul 2023 16:51:50 +0300 Subject: [PATCH] DM-340, change notification texts, hide rss specifics. --- .../notifications-screen.component.html | 2 +- .../notifications-screen.component.ts | 53 +++++++++++-------- apps/red-ui/src/assets/i18n/scm/en.json | 8 +-- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.html b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.html index 281579968..b883c12df 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.html +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.html @@ -13,7 +13,7 @@
- + (); - constructor( - private readonly _toaster: Toaster, - private readonly _formBuilder: UntypedFormBuilder, - private readonly _loadingService: LoadingService, - private readonly _notificationPreferencesService: NotificationPreferencesService, - private readonly _changeRef: ChangeDetectorRef, - ) { + readonly #toaster = inject(Toaster); + readonly #formBuilder = inject(UntypedFormBuilder); + readonly #loadingService = inject(LoadingService); + readonly #notificationPreferencesService = inject(NotificationPreferencesService); + readonly #cdRef = inject(ChangeDetectorRef); + readonly #iqserPermissionsService = inject(IqserPermissionsService); + readonly #isRss = this.#iqserPermissionsService.has(Roles.getRss); + + constructor() { super(); } async ngOnInit(): Promise { - await this._initializeForm(); + await this.#initializeForm(); + } + + getRssFilteredSettings(settings: string[]) { + return settings.filter(s => (this.#isRss ? !RSS_EXCLUDED_SETTINGS.includes(s) : true)); } isCategoryActive(category: string) { @@ -66,19 +75,19 @@ export class NotificationsScreenComponent extends BaseFormComponent implements O } async save() { - this._loadingService.start(); + this.#loadingService.start(); try { - await firstValueFrom(this._notificationPreferencesService.update(this.form.value)); + await firstValueFrom(this.#notificationPreferencesService.update(this.form.value)); } catch (e) { - this._toaster.error(_('notifications-screen.error.generic')); + this.#toaster.error(_('notifications-screen.error.generic')); } this.initialFormValue = JSON.parse(JSON.stringify(this.form.getRawValue())); - this._changeRef.markForCheck(); - this._loadingService.stop(); + this.#cdRef.markForCheck(); + this.#loadingService.stop(); } - private _getForm(): UntypedFormGroup { - return this._formBuilder.group({ + #getForm(): UntypedFormGroup { + return this.#formBuilder.group({ inAppNotificationsEnabled: [undefined], emailNotificationsEnabled: [undefined], emailNotificationType: [undefined], @@ -87,14 +96,14 @@ export class NotificationsScreenComponent extends BaseFormComponent implements O }); } - private async _initializeForm() { - this._loadingService.start(); + async #initializeForm() { + this.#loadingService.start(); - this.form = this._getForm(); - const notificationPreferences = await firstValueFrom(this._notificationPreferencesService.get()); + this.form = this.#getForm(); + const notificationPreferences = await firstValueFrom(this.#notificationPreferencesService.get()); this.form.patchValue(notificationPreferences); this.initialFormValue = JSON.parse(JSON.stringify(this.form.getRawValue())); - this._loadingService.stop(); + this.#loadingService.stop(); } } diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index 2f8bf1f8b..0cd361f84 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -1717,9 +1717,9 @@ "minutes": "minutes", "no-active-license": "Invalid or corrupt license – Please contact your administrator", "notification": { - "assign-approver": "You have been assigned as approver for {fileHref, select, null{{fileName}} other{{fileName}}} in dossier: {dossierHref, select, null{{dossierName}} other{{dossierName}}}!", + "assign-approver": "You have been assigned to {fileHref, select, null{{fileName}} other{{fileName}}} in dossier: {dossierHref, select, null{{dossierName}} other{{dossierName}}}!", "assign-reviewer": "You have been assigned as reviewer for {fileHref, select, null{{fileName}} other{{fileName}}} in dossier: {dossierHref, select, null{{dossierName}} other{{dossierName}}}!", - "document-approved": " {fileHref, select, null{{fileName}} other{{fileName}}} has been approved!", + "document-approved": " {fileHref, select, null{{fileName}} other{{fileName}}} has been moved to Done!", "dossier-deleted": "Dossier: {dossierName} has been deleted!", "dossier-owner-deleted": "The owner of dossier: {dossierName} has been deleted!", "dossier-owner-removed": "You have been removed as dossier owner from {dossierHref, select, null{{dossierName}} other{{dossierName}}}!", @@ -1747,9 +1747,9 @@ }, "options-title": "Choose on which action you want to be notified", "options": { - "ASSIGN_APPROVER": "When I am assigned to a document as Approver", + "ASSIGN_APPROVER": "When I am assigned to a document", "ASSIGN_REVIEWER": "When I am assigned to a document as Reviewer", - "DOCUMENT_APPROVED": "When the document status changes to Approved (only for dossier owners)", + "DOCUMENT_APPROVED": "When the document status changes to Done (only for dossier owners)", "DOCUMENT_UNDER_APPROVAL": "When the document status changes to Under Approval", "DOCUMENT_UNDER_REVIEW": "When the document status changes to In Progress", "DOSSIER_DELETED": "When a dossier was deleted",