From 773448dcb1b0420c06913d43e3659b7ff142e530 Mon Sep 17 00:00:00 2001 From: Valentin Date: Wed, 8 Dec 2021 14:35:28 +0200 Subject: [PATCH] updated notifications preferences keys and grouping --- .../screens/notifications/constants.ts | 45 ++++++++++--------- .../notifications-screen.component.html | 8 ++-- .../notifications-translations.ts | 31 +++++++------ apps/red-ui/src/assets/i18n/en.json | 31 +++++++------ 4 files changed, 64 insertions(+), 51 deletions(-) diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts b/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts index 3c98f33b1..a6649c927 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts +++ b/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts @@ -5,34 +5,39 @@ export const NotificationCategories = { export const NotificationCategoriesValues = Object.values(NotificationCategories); -export const OwnDossiersNotificationsTypes = { - dossierStatusChanges: 'dossierStatusChanges', - requestToJoinTheDossier: 'requestToJoinTheDossier', - documentStatusChanges: 'documentStatusChanges', - documentIsSentForApproval: 'documentIsSentForApproval', +export const DossierNotificationsTypes = { + dossierOwnerSet: 'DOSSIER_OWNER_SET', + dossierOwnerRemoved: 'DOSSIER_OWNER_REMOVED', + userBecomseDossierMember: 'USER_BECOMES_DOSSIER_MEMBER', + userRemovedAsDossierMember: 'USER_REMOVED_AS_DOSSIER_MEMBER', + userPromotedToApprover: 'USER_PROMOTED_TO_APPROVER', + userDegradedToReviewer: 'USER_DEGRADED_TO_REVIEWER', + dossierOwnerDeleted: 'DOSSIER_OWNER_DELETED', + dossierDeleted: 'DOSSIER_DELETED', } as const; -export const OwnDossiersNotificationsTypesValues = Object.values(OwnDossiersNotificationsTypes); +export const DossierNotificationsTypesValues = Object.values(DossierNotificationsTypes); -export const ReviewerOnDossiersNotificationsTypes = { - whenIAmAssignedOnADocument: 'whenIAmAssignedOnADocument', - whenIAmUnassignedFromADocument: 'whenIAmUnassignedFromADocument', - whenADocumentIsApproved: 'whenADocumentIsApproved', +export const DocumentNotificationsTypes = { + assignReviewer: 'ASSIGN_REVIEWER', + assignApprover: 'ASSIGN_APPROVER', + unassignedFromFile: 'UNASSIGNED_FROM_FILE', + // documentUnderReview: 'DOCUMENT_UNDER_REVIEW', + // documentUnderApproval: 'DOCUMENT_UNDER_APPROVAL', + documentApproved: 'DOCUMENT_APPROVED', } as const; -export const ReviewerOnDossiersNotificationsTypesValues = Object.values(ReviewerOnDossiersNotificationsTypes); +export const DocumentNotificationsTypesValues = Object.values(DocumentNotificationsTypes); -export const ApproverOnDossiersNotificationsTypes = { - whenADocumentIsSentForApproval: 'whenADocumentIsSentForApproval', - whenADocumentIsAssignedToAReviewer: 'whenADocumentIsAssignedToAReviewer', - whenAReviewerIsUnassignedFromADocument: 'whenAReviewerIsUnassignedFromADocument', +export const OtherNotificationsTypes = { + downloadReady: 'DOWNLOAD_READY', } as const; -export const ApproverOnDossiersNotificationsTypesValues = Object.values(ApproverOnDossiersNotificationsTypes); +export const OtherNotificationsTypesValues = Object.values(OtherNotificationsTypes); -export const NotificationGroupsKeys = ['own', 'reviewer', 'approver'] as const; +export const NotificationGroupsKeys = ['dossier', 'document', 'other'] as const; export const NotificationGroupsValues = [ - OwnDossiersNotificationsTypesValues, - ReviewerOnDossiersNotificationsTypesValues, - ApproverOnDossiersNotificationsTypesValues, + DossierNotificationsTypesValues, + DocumentNotificationsTypesValues, + OtherNotificationsTypesValues, ] as const; 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 db13ee0bd..8c76795dc 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 @@ -18,9 +18,8 @@
- - - +
+
- - +
diff --git a/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts b/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts index c85d03104..872a7afa3 100644 --- a/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts +++ b/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts @@ -6,19 +6,24 @@ export const notificationsTranslations: { [key: string]: string } = { weekly_summary: _('notifications-screen.schedule.weekly'), inAppNotifications: _('notifications-screen.category.in-app-notifications'), emailNotifications: _('notifications-screen.category.email-notifications'), - documentIsSentForApproval: _('notifications-screen.options.document-is-sent-for-approval'), - documentStatusChanges: _('notifications-screen.options.document-status-changes'), - dossierStatusChanges: _('notifications-screen.options.dossier-status-changes'), - requestToJoinTheDossier: _('notifications-screen.options.request-to-join-the-dossier'), - whenADocumentIsApproved: _('notifications-screen.options.when-a-document-is-approved'), - whenADocumentIsAssignedToAReviewer: _('notifications-screen.options.when-a-document-is-assigned-to-a-reviewer'), - whenADocumentIsSentForApproval: _('notifications-screen.options.when-a-document-is-sent-for-approval'), - whenAReviewerIsUnassignedFromADocument: _('notifications-screen.options.when-a-reviewer-is-unassigned-from-a-document'), - whenIAmAssignedOnADocument: _('notifications-screen.options.when-i-am-assigned-on-a-document'), - whenIAmUnassignedFromADocument: _('notifications-screen.options.when-i-am-unassigned-from-a-document'), - approver: _('notifications-screen.groups.approver'), - own: _('notifications-screen.groups.own'), - reviewer: _('notifications-screen.groups.reviewer'), + DOSSIER_OWNER_SET: _('notifications-screen.options.DOSSIER_OWNER_SET'), + DOSSIER_OWNER_REMOVED: _('notifications-screen.options.DOSSIER_OWNER_REMOVED'), + USER_BECOMES_DOSSIER_MEMBER: _('notifications-screen.options.USER_BECOMES_DOSSIER_MEMBER'), + USER_REMOVED_AS_DOSSIER_MEMBER: _('notifications-screen.options.USER_REMOVED_AS_DOSSIER_MEMBER'), + USER_PROMOTED_TO_APPROVER: _('notifications-screen.options.USER_PROMOTED_TO_APPROVER'), + USER_DEGRADED_TO_REVIEWER: _('notifications-screen.options.USER_DEGRADED_TO_REVIEWER'), + DOSSIER_OWNER_DELETED: _('notifications-screen.options.DOSSIER_OWNER_DELETED'), + DOSSIER_DELETED: _('notifications-screen.options.DOSSIER_DELETED'), + ASSIGN_REVIEWER: _('notifications-screen.options.ASSIGN_REVIEWER'), + ASSIGN_APPROVER: _('notifications-screen.options.ASSIGN_APPROVER'), + UNASSIGNED_FROM_FILE: _('notifications-screen.options.UNASSIGNED_FROM_FILE'), + DOCUMENT_UNDER_REVIEW: _('notifications-screen.options.DOCUMENT_UNDER_REVIEW'), + DOCUMENT_UNDER_APPROVAL: _('notifications-screen.options.DOCUMENT_UNDER_APPROVAL'), + DOCUMENT_APPROVED: _('notifications-screen.options.DOCUMENT_APPROVED'), + DOWNLOAD_READY: _('notifications-screen.options.DOWNLOAD_READY'), + dossier: _('notifications-screen.groups.dossier'), + document: _('notifications-screen.groups.document'), + other: _('notifications-screen.groups.other'), notifications: _('notifications-screen.title'), 'user-profile': _('user-profile-screen.title'), } as const; diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 10f19570b..df08ffa5e 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1311,22 +1311,27 @@ "generic": "Something went wrong... Preferences update failed!" }, "groups": { - "approver": "Dossiers you are approver on", - "own": "Dossiers you own", - "reviewer": "Dossiers you are reviewer on" + "dossier": "Dossier related notifications", + "document": "Document related notifications", + "other": "Other notifications" }, "options-title": "Choose on which action you want to be notified", "options": { - "document-is-sent-for-approval": "Document is sent for approval", - "document-status-changes": "Document status changes", - "dossier-status-changes": "Dossier status changes", - "request-to-join-the-dossier": "Request to join the dossier", - "when-a-document-is-approved": "When a document is approved", - "when-a-document-is-assigned-to-a-reviewer": "When a document is assigned to a reviewer", - "when-a-document-is-sent-for-approval": "When a document is sent for approval", - "when-a-reviewer-is-unassigned-from-a-document": "When a reviewer is unassigned from a document", - "when-i-am-assigned-on-a-document": "When I am assigned on a document", - "when-i-am-unassigned-from-a-document": "When I am unassigned from a document" + "DOSSIER_OWNER_SET": "When I become the dossier owner", + "DOSSIER_OWNER_REMOVED": "When I loose dossier ownership", + "USER_BECOMES_DOSSIER_MEMBER": "When a user was added to my dossier", + "USER_REMOVED_AS_DOSSIER_MEMBER": "When I loose dossier membership", + "USER_PROMOTED_TO_APPROVER": "When I become an Approver in a dossier", + "USER_DEGRADED_TO_REVIEWER": "When I become a Reviewer in a dossier", + "DOSSIER_OWNER_DELETED": "When the owner of a dossier got deleted", + "DOSSIER_DELETED": "When a dossier was deleted", + "ASSIGN_REVIEWER": "When I am assigned to a document as Reviewer", + "ASSIGN_APPROVER": "When I am assigned to a document as Approver", + "UNASSIGNED_FROM_FILE": "When I am unassigned from a document", + "DOCUMENT_UNDER_REVIEW": "When the document status changes to Under Review", + "DOCUMENT_UNDER_APPROVAL": "When the document status changes to Under Approval", + "DOCUMENT_APPROVED": "When the document status changes to Approved", + "DOWNLOAD_READY": "When a download is ready" }, "schedule": { "daily": "Daily Summary",