diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ec69a908..0f26eb95 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -38,3 +38,6 @@ If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. + +**Areas that will be affected** +_Optional, to be added by developer if relevant_ diff --git a/.github/ISSUE_TEMPLATE/user_story.md b/.github/ISSUE_TEMPLATE/user_story.md index e97a82ce..cfc1b594 100644 --- a/.github/ISSUE_TEMPLATE/user_story.md +++ b/.github/ISSUE_TEMPLATE/user_story.md @@ -18,3 +18,7 @@ So that - [ ] … ## Additional Context + +## Areas that will be affected + +_To be added during the refinement_ diff --git a/.vscode/settings.json b/.vscode/settings.json index 04667f28..b617a206 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "files.eol": "\n" } diff --git a/lib/package-lock.json b/lib/package-lock.json index 11d2a82d..7a84d894 100644 --- a/lib/package-lock.json +++ b/lib/package-lock.json @@ -1,12 +1,12 @@ { "name": "@alkemio/notifications-lib", - "version": "0.6.0", + "version": "0.7.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@alkemio/notifications-lib", - "version": "0.6.0", + "version": "0.7.0", "license": "EUPL-1.2", "devDependencies": { "@types/node": "^16.4.6", diff --git a/lib/package.json b/lib/package.json index 6a855ecc..b652c84c 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,6 +1,6 @@ { "name": "@alkemio/notifications-lib", - "version": "0.6.0", + "version": "0.7.1", "description": "Library for interacting with Alkemio notifications service", "author": "Alkemio Foundation", "private": false, diff --git a/lib/src/common/alkemio-url-generator/alkemio.url.generator.ts b/lib/src/common/alkemio-url-generator/alkemio.url.generator.ts deleted file mode 100644 index a5362f45..00000000 --- a/lib/src/common/alkemio-url-generator/alkemio.url.generator.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { JourneyPayload } from '@src/dto/journey.payload'; -import { JourneyType } from '../enums/journey.type'; - -export const createJourneyURL = ( - webclientEndpoint: string, - journey: JourneyPayload -): string => { - const baseURL = `${webclientEndpoint}/${journey.spaceNameID}`; - switch (journey.type) { - case JourneyType.SPACE: - return baseURL; - case JourneyType.CHALLENGE: - return `${baseURL}/challenges/${journey.challenge?.nameID}`; - case JourneyType.OPPORTUNITY: - return `${baseURL}/challenges/${journey.challenge?.nameID}/opportunities/${journey.challenge?.opportunity?.nameID}`; - } - - return baseURL; -}; - -export const createJourneyAdminCommunityURL = ( - webclientEndpoint: string, - journey: JourneyPayload -): string => { - const baseURL = `${webclientEndpoint}/admin/spaces/${journey.spaceNameID}`; - switch (journey.type) { - case JourneyType.SPACE: - return `${baseURL}/community`; - case JourneyType.CHALLENGE: - return `${baseURL}/challenges/${journey.challenge?.nameID}/community`; - case JourneyType.OPPORTUNITY: - return `${baseURL}/challenges/${journey.challenge?.nameID}/opportunities/${journey.challenge?.opportunity?.nameID}/community`; - } - - return baseURL; -}; - -export const createUserURL = ( - webclientEndpoint: string, - userNameID: string -): string => { - return `${webclientEndpoint}/user/${userNameID}`; -}; - -export const createCalloutURL = ( - journeyURL: string, - calloutNameID: string -): string => { - return `${journeyURL}/collaboration/${calloutNameID}`; -}; - -export const createPostURL = ( - journeyURL: string, - calloutNameID: string, - postNameID: string -): string => { - return `${journeyURL}/collaboration/${calloutNameID}/posts/${postNameID}`; -}; - -export const createWhiteboardURL = ( - journeyURL: string, - calloutNameID: string, - whiteboardNameID: string -): string => { - return `${journeyURL}/collaboration/${calloutNameID}/whiteboardes/${whiteboardNameID}`; -}; - -export const createOrganizationURL = ( - webclientEndpoint: string, - orgNameID: string -): string => { - return `${webclientEndpoint}/organization/${orgNameID}`; -}; - -export const createUserNotificationPreferencesURL = ( - webclientEndpoint: string, - userNameID: string -): string => { - return `${webclientEndpoint}/user/${userNameID}/settings/notifications`; -}; - -export const createCalendarEventURL = ( - journeyURL: string, - calendarEventNameId: string -): string => { - return `${journeyURL}/dashboard/calendar/${calendarEventNameId}`; -}; - -export const createForumDiscussionUrl = ( - webclientEndpoint: string, - discussionNameId: string -): string => { - return `${webclientEndpoint}/forum/discussion/${discussionNameId}`; -}; diff --git a/lib/src/common/enums/journey.type.ts b/lib/src/common/enums/space.type.ts similarity index 84% rename from lib/src/common/enums/journey.type.ts rename to lib/src/common/enums/space.type.ts index da61b232..b27ef937 100644 --- a/lib/src/common/enums/journey.type.ts +++ b/lib/src/common/enums/space.type.ts @@ -1,5 +1,5 @@ // todo: remove once notifications can use the types directly from -export enum JourneyType { +export enum SpaceType { SPACE = 'space', CHALLENGE = 'challenge', OPPORTUNITY = 'opportunity', diff --git a/lib/src/dto/base.event.payload.ts b/lib/src/dto/base.event.payload.ts index 5ef2f2b9..916c87e5 100644 --- a/lib/src/dto/base.event.payload.ts +++ b/lib/src/dto/base.event.payload.ts @@ -1,4 +1,7 @@ // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface BaseEventPayload { triggeredBy: string; + platform: { + url: string; + } } diff --git a/lib/src/dto/collaboration.callout.published.event.payload.ts b/lib/src/dto/collaboration.callout.published.event.payload.ts index 994fbb46..4f8b5acc 100644 --- a/lib/src/dto/collaboration.callout.published.event.payload.ts +++ b/lib/src/dto/collaboration.callout.published.event.payload.ts @@ -1,11 +1,12 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; -export interface CollaborationCalloutPublishedEventPayload extends JourneyBaseEventPayload { +export interface CollaborationCalloutPublishedEventPayload extends SpaceBaseEventPayload { callout: { id: string; displayName: string; description: string; nameID: string; type: string; + url: string; }; } diff --git a/lib/src/dto/collaboration.context.review.submitted.payload.ts b/lib/src/dto/collaboration.context.review.submitted.payload.ts deleted file mode 100644 index 1830ed71..00000000 --- a/lib/src/dto/collaboration.context.review.submitted.payload.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; - -export interface CollaborationContextReviewSubmittedPayload - extends JourneyBaseEventPayload { - questions: FeedbackQuestions[]; -} - -export type FeedbackQuestions = { - name: string; - value: string; - sortOrder: number; -}; diff --git a/lib/src/dto/collaboration.discussion.comment.event.payload.ts b/lib/src/dto/collaboration.discussion.comment.event.payload.ts index 1482a708..b51384c1 100644 --- a/lib/src/dto/collaboration.discussion.comment.event.payload.ts +++ b/lib/src/dto/collaboration.discussion.comment.event.payload.ts @@ -1,9 +1,10 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; -export interface CollaborationDiscussionCommentEventPayload extends JourneyBaseEventPayload { +export interface CollaborationDiscussionCommentEventPayload extends SpaceBaseEventPayload { callout: { displayName: string; nameID: string; + url: string; } comment: { message: string; diff --git a/lib/src/dto/collaboration.interest.payload.ts b/lib/src/dto/collaboration.interest.payload.ts deleted file mode 100644 index 97cde6e5..00000000 --- a/lib/src/dto/collaboration.interest.payload.ts +++ /dev/null @@ -1,10 +0,0 @@ - -import { JourneyBaseEventPayload } from './journey.base.event.payload'; - -export interface CollaborationInterestPayload - extends JourneyBaseEventPayload { - relation: { - role: string; - description: string; - }; -} diff --git a/lib/src/dto/collaboration.post.comment.event.payload.ts b/lib/src/dto/collaboration.post.comment.event.payload.ts index f612fbac..0bf174f3 100644 --- a/lib/src/dto/collaboration.post.comment.event.payload.ts +++ b/lib/src/dto/collaboration.post.comment.event.payload.ts @@ -1,14 +1,16 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; -export interface CollaborationPostCommentEventPayload extends JourneyBaseEventPayload { +export interface CollaborationPostCommentEventPayload extends SpaceBaseEventPayload { callout: { displayName: string; nameID: string; + url: string; } post: { displayName: string; createdBy: string; nameID: string; + url: string; }; comment: { message: string; diff --git a/lib/src/dto/collaboration.post.created.event.payload.ts b/lib/src/dto/collaboration.post.created.event.payload.ts index 2680d46b..d55f704c 100644 --- a/lib/src/dto/collaboration.post.created.event.payload.ts +++ b/lib/src/dto/collaboration.post.created.event.payload.ts @@ -1,9 +1,10 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; -export interface CollaborationPostCreatedEventPayload extends JourneyBaseEventPayload { +export interface CollaborationPostCreatedEventPayload extends SpaceBaseEventPayload { callout: { displayName: string; nameID: string; + url: string; } post: { id: string; @@ -11,5 +12,6 @@ export interface CollaborationPostCreatedEventPayload extends JourneyBaseEventPa displayName: string; nameID: string; type: string; + url: string; }; } diff --git a/lib/src/dto/collaboration.whiteboard.created.event.payload.ts b/lib/src/dto/collaboration.whiteboard.created.event.payload.ts index 969c1b93..9005c7a5 100644 --- a/lib/src/dto/collaboration.whiteboard.created.event.payload.ts +++ b/lib/src/dto/collaboration.whiteboard.created.event.payload.ts @@ -1,14 +1,16 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; -export interface CollaborationWhiteboardCreatedEventPayload extends JourneyBaseEventPayload { +export interface CollaborationWhiteboardCreatedEventPayload extends SpaceBaseEventPayload { callout: { displayName: string; nameID: string; + url: string; } whiteboard: { id: string; createdBy: string; displayName: string; nameID: string; + url: string; }; } diff --git a/lib/src/dto/communication.community.leads.message.payload.ts b/lib/src/dto/communication.community.leads.message.payload.ts index 994e07f6..c5bcb25f 100644 --- a/lib/src/dto/communication.community.leads.message.payload.ts +++ b/lib/src/dto/communication.community.leads.message.payload.ts @@ -1,6 +1,6 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; export interface CommunicationCommunityLeadsMessageEventPayload - extends JourneyBaseEventPayload { + extends SpaceBaseEventPayload { message: string; } diff --git a/lib/src/dto/communication.organization.mention.event.payload.ts b/lib/src/dto/communication.organization.mention.event.payload.ts index 956e2784..ed0dc8c1 100644 --- a/lib/src/dto/communication.organization.mention.event.payload.ts +++ b/lib/src/dto/communication.organization.mention.event.payload.ts @@ -1,11 +1,9 @@ import { BaseEventPayload } from './base.event.payload'; +import { ContributorPayload } from './contributor.payload'; export interface CommunicationOrganizationMentionEventPayload extends BaseEventPayload { comment: string; - mentionedOrganization: { - id: string; - displayName: string; - }; + mentionedOrganization: ContributorPayload; commentOrigin: { url: string; displayName: string; diff --git a/lib/src/dto/communication.organization.message.event.payload.ts b/lib/src/dto/communication.organization.message.event.payload.ts index e35b6e9d..371e71bd 100644 --- a/lib/src/dto/communication.organization.message.event.payload.ts +++ b/lib/src/dto/communication.organization.message.event.payload.ts @@ -1,9 +1,7 @@ import { BaseEventPayload } from './base.event.payload'; +import { ContributorPayload } from './contributor.payload'; export interface CommunicationOrganizationMessageEventPayload extends BaseEventPayload { message: string; - organization: { - id: string; - displayName: string; - }; + organization: ContributorPayload; } diff --git a/lib/src/dto/communication.update.event.payload.ts b/lib/src/dto/communication.update.event.payload.ts index 0f72b009..bdda014f 100644 --- a/lib/src/dto/communication.update.event.payload.ts +++ b/lib/src/dto/communication.update.event.payload.ts @@ -1,9 +1,10 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; -export interface CommunicationUpdateEventPayload extends JourneyBaseEventPayload { +export interface CommunicationUpdateEventPayload extends SpaceBaseEventPayload { update: { id: string; createdBy: string; + url: string; }; } diff --git a/lib/src/dto/communication.user.mention.event.payload.ts b/lib/src/dto/communication.user.mention.event.payload.ts index 6f3220d3..31b3bf82 100644 --- a/lib/src/dto/communication.user.mention.event.payload.ts +++ b/lib/src/dto/communication.user.mention.event.payload.ts @@ -1,10 +1,8 @@ import { BaseEventPayload } from './base.event.payload'; +import { ContributorPayload } from './contributor.payload'; export interface CommunicationUserMentionEventPayload extends BaseEventPayload { comment: string; - mentionedUser: { - id: string; - displayName: string; - }; + mentionedUser: ContributorPayload; commentOrigin: { url: string; displayName: string; diff --git a/lib/src/dto/communication.user.message.event.payload.ts b/lib/src/dto/communication.user.message.event.payload.ts index 13ab8ee2..624ebef6 100644 --- a/lib/src/dto/communication.user.message.event.payload.ts +++ b/lib/src/dto/communication.user.message.event.payload.ts @@ -1,8 +1,6 @@ import { BaseEventPayload } from './base.event.payload'; +import { ContributorPayload } from './contributor.payload'; export interface CommunicationUserMessageEventPayload extends BaseEventPayload { message: string; - messageReceiver: { - id: string; - displayName: string; - }; + messageReceiver: ContributorPayload; } diff --git a/lib/src/dto/community.application.created.event.payload.ts b/lib/src/dto/community.application.created.event.payload.ts index 62cefb8c..fecdd762 100644 --- a/lib/src/dto/community.application.created.event.payload.ts +++ b/lib/src/dto/community.application.created.event.payload.ts @@ -1,6 +1,7 @@ -import { JourneyPayload } from './journey.payload'; -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { SpacePayload } from './space.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; +import { ContributorPayload } from './contributor.payload'; -export interface CommunityApplicationCreatedEventPayload extends JourneyBaseEventPayload { - applicantID: string; +export interface CommunityApplicationCreatedEventPayload extends SpaceBaseEventPayload { + applicant: ContributorPayload; } diff --git a/lib/src/dto/community.external.invitation.created.event.payload.ts b/lib/src/dto/community.external.invitation.created.event.payload.ts index f9223c54..bd2a35cb 100644 --- a/lib/src/dto/community.external.invitation.created.event.payload.ts +++ b/lib/src/dto/community.external.invitation.created.event.payload.ts @@ -1,6 +1,6 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; export interface CommunityExternalInvitationCreatedEventPayload - extends JourneyBaseEventPayload { + extends SpaceBaseEventPayload { invitees: { email: string; }[]; diff --git a/lib/src/dto/community.invitation.created.event.payload.ts b/lib/src/dto/community.invitation.created.event.payload.ts index a1900e10..cf76f5e5 100644 --- a/lib/src/dto/community.invitation.created.event.payload.ts +++ b/lib/src/dto/community.invitation.created.event.payload.ts @@ -1,6 +1,7 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { ContributorPayload } from './contributor.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; export interface CommunityInvitationCreatedEventPayload - extends JourneyBaseEventPayload { - inviteeID: string; + extends SpaceBaseEventPayload { + invitee: ContributorPayload; } diff --git a/lib/src/dto/community.new.member.payload.ts b/lib/src/dto/community.new.member.payload.ts index 2a7e58a1..8e137645 100644 --- a/lib/src/dto/community.new.member.payload.ts +++ b/lib/src/dto/community.new.member.payload.ts @@ -1,6 +1,7 @@ -import { JourneyBaseEventPayload } from './journey.base.event.payload'; +import { ContributorPayload } from './contributor.payload'; +import { SpaceBaseEventPayload } from './space.base.event.payload'; -export interface CommunityNewMemberPayload extends JourneyBaseEventPayload { - userID: string; +export interface CommunityNewMemberPayload extends SpaceBaseEventPayload { + user: ContributorPayload; } diff --git a/lib/src/dto/contributor.payload.ts b/lib/src/dto/contributor.payload.ts new file mode 100644 index 00000000..7dadd17b --- /dev/null +++ b/lib/src/dto/contributor.payload.ts @@ -0,0 +1,10 @@ +import { SpaceType } from "@src/common/enums/space.type"; + +export type ContributorPayload = { + id: string; + nameID: string; + profile: { + displayName: string; + url: string; + } +}; diff --git a/lib/src/dto/index.ts b/lib/src/dto/index.ts index c50610b3..8d090496 100644 --- a/lib/src/dto/index.ts +++ b/lib/src/dto/index.ts @@ -1,5 +1,7 @@ export * from './base.event.payload'; -export * from './journey.payload'; +export * from './space.base.event.payload'; +export * from './space.payload'; +export * from './contributor.payload'; export * from './communication.update.event.payload'; export * from './communication.user.message.event.payload'; export * from './communication.organization.message.event.payload'; @@ -10,13 +12,11 @@ export * from './community.application.created.event.payload'; export * from './community.new.member.payload'; export * from './community.invitation.created.event.payload'; export * from './community.external.invitation.created.event.payload'; -export * from './collaboration.interest.payload'; export * from './collaboration.whiteboard.created.event.payload'; export * from './collaboration.post.created.event.payload'; export * from './collaboration.post.comment.event.payload'; export * from './collaboration.callout.published.event.payload'; export * from './collaboration.discussion.comment.event.payload'; -export * from './collaboration.context.review.submitted.payload'; export * from './platform.user.registration.event.payload'; export * from './platform.user.removed.event.payload'; export * from './platform.forum.discussion.comment.event.payload'; diff --git a/lib/src/dto/journey.base.event.payload.ts b/lib/src/dto/journey.base.event.payload.ts deleted file mode 100644 index e50051f4..00000000 --- a/lib/src/dto/journey.base.event.payload.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { JourneyPayload } from './journey.payload'; -import { BaseEventPayload } from './base.event.payload'; - -export interface JourneyBaseEventPayload - extends BaseEventPayload { - journey: JourneyPayload; -} diff --git a/lib/src/dto/journey.payload.ts b/lib/src/dto/journey.payload.ts deleted file mode 100644 index 4216e97d..00000000 --- a/lib/src/dto/journey.payload.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { JourneyType } from "@src/common/enums/journey.type"; - -export type JourneyPayload = { - spaceID: string; - spaceNameID: string; - displayName: string; - type: JourneyType; - challenge?: { - id: string; - nameID: string; - opportunity?: { - nameID: string; - id: string; - }; - }; -}; diff --git a/lib/src/dto/platform.forum.discussion.comment.event.payload.ts b/lib/src/dto/platform.forum.discussion.comment.event.payload.ts index ad0030b9..b6c88da7 100644 --- a/lib/src/dto/platform.forum.discussion.comment.event.payload.ts +++ b/lib/src/dto/platform.forum.discussion.comment.event.payload.ts @@ -10,5 +10,6 @@ export interface PlatformForumDiscussionCommentEventPayload comment: { message: string; createdBy: string; + url: string; }; } diff --git a/lib/src/dto/platform.user.registration.event.payload.ts b/lib/src/dto/platform.user.registration.event.payload.ts index 62330da5..991e545f 100644 --- a/lib/src/dto/platform.user.registration.event.payload.ts +++ b/lib/src/dto/platform.user.registration.event.payload.ts @@ -1,6 +1,7 @@ import { BaseEventPayload } from "./base.event.payload"; +import { ContributorPayload } from "./contributor.payload"; export interface PlatformUserRegistrationEventPayload extends BaseEventPayload { - userID: string; + user: ContributorPayload; }; diff --git a/lib/src/dto/space.base.event.payload.ts b/lib/src/dto/space.base.event.payload.ts new file mode 100644 index 00000000..4e7c5f67 --- /dev/null +++ b/lib/src/dto/space.base.event.payload.ts @@ -0,0 +1,7 @@ +import { SpacePayload } from './space.payload'; +import { BaseEventPayload } from './base.event.payload'; + +export interface SpaceBaseEventPayload + extends BaseEventPayload { + space: SpacePayload; +} diff --git a/lib/src/dto/space.payload.ts b/lib/src/dto/space.payload.ts new file mode 100644 index 00000000..8003ec3f --- /dev/null +++ b/lib/src/dto/space.payload.ts @@ -0,0 +1,12 @@ +import { SpaceType } from "@src/common/enums/space.type"; + +export type SpacePayload = { + id: string; + nameID: string; + type: SpaceType; + profile: { + displayName: string; + url: string; + } + adminURL: string; +}; diff --git a/lib/src/index.ts b/lib/src/index.ts index d8d65739..430dfb96 100644 --- a/lib/src/index.ts +++ b/lib/src/index.ts @@ -1,4 +1,3 @@ export * from './notification.event.type'; export * from './dto'; -export * from './common/enums/journey.type'; -export * from './common/alkemio-url-generator/alkemio.url.generator'; +export * from './common/enums/space.type'; diff --git a/lib/src/notification.event.type.ts b/lib/src/notification.event.type.ts index 5f2df235..7417f9cb 100644 --- a/lib/src/notification.event.type.ts +++ b/lib/src/notification.event.type.ts @@ -10,8 +10,6 @@ export enum NotificationEventType { COMMUNICATION_COMMUNITY_MESSAGE = 'communicationCommunityMessage', COMMUNICATION_USER_MENTION = 'communicationUserMention', COMMUNICATION_ORGANIZATION_MENTION = 'communicationOrganizationMention', - COLLABORATION_INTEREST = 'collaborationInterest', - COLLABORATION_CONTEXT_REVIEW_SUBMITTED = 'collaborationContextReviewSubmitted', COLLABORATION_WHITEBOARD_CREATED = 'collaborationWhiteboardCreated', COLLABORATION_POST_CREATED = 'collaborationPostCreated', COLLABORATION_POST_COMMENT = 'collaborationPostComment', diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 4710f8e5..00000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "notifications", - "lockfileVersion": 2, - "requires": true, - "packages": {} -} diff --git a/service/manifests/25-notifications-deployment-dev.yaml b/service/manifests/25-notifications-deployment-dev.yaml index dbfa8192..c480a7f4 100644 --- a/service/manifests/25-notifications-deployment-dev.yaml +++ b/service/manifests/25-notifications-deployment-dev.yaml @@ -40,6 +40,11 @@ spec: secretKeyRef: name: alkemio-rabbitmq-cluster-default-user key: password + - name: ALKEMIO_WEBCLIENT_ENDPOINT + valueFrom: + configMapKeyRef: + name: alkemio-config + key: ENDPOINT_CLUSTER envFrom: - secretRef: name: alkemio-secrets diff --git a/service/notifications.yml b/service/notifications.yml index 8e572f4f..56f476e1 100644 --- a/service/notifications.yml +++ b/service/notifications.yml @@ -89,15 +89,12 @@ recipients: community_application_created: - name: admin rules: - - rule: - type: CHALLENGE_ADMIN - resource_id: - - rule: - type: OPPORTUNITY_ADMIN - resource_id: - rule: type: SPACE_ADMIN resource_id: + - rule: + type: SUBSPACE_ADMIN + resource_id: - rule: type: GLOBAL_ADMIN_COMMUNITY resource_id: @@ -116,11 +113,8 @@ recipients: type: SPACE_ADMIN resource_id: - rule: - type: CHALLENGE_ADMIN - resource_id: - - rule: - type: OPPORTUNITY_ADMIN - resource_id: + type: SUBSPACE_ADMIN + resource_id: - name: member rules: - rule: @@ -156,13 +150,10 @@ recipients: rules: - rule: type: SPACE_MEMBER - resource_id: - - rule: - type: CHALLENGE_MEMBER - resource_id: + resource_id: - rule: - type: OPPORTUNITY_MEMBER - resource_id: + type: SUBSPACE_MEMBER + resource_id: communication_user_message: - name: sender rules: @@ -195,13 +186,10 @@ recipients: rules: - rule: type: SPACE_LEAD - resource_id: - - rule: - type: CHALLENGE_LEAD - resource_id: + resource_id: - rule: - type: OPPORTUNITY_LEAD - resource_id: + type: SUBSPACE_LEAD + resource_id: communication_user_mention: - name: receiver rules: @@ -214,28 +202,6 @@ recipients: - rule: type: ORGANIZATION_ADMIN resource_id: - collaboration_review_submitted: - - name: admin - rules: - - rule: - type: CHALLENGE_ADMIN - resource_id: - - name: reviewer - rules: - - rule: - type: USER_SELF_MANAGEMENT - resource_id: - collaboration_interest: - - name: admin - rules: - - rule: - type: OPPORTUNITY_ADMIN - resource_id: - - name: user - rules: - - rule: - type: USER_SELF_MANAGEMENT - resource_id: collaboration_post_created: - name: admin rules: @@ -243,22 +209,16 @@ recipients: type: SPACE_ADMIN resource_id: - rule: - type: CHALLENGE_ADMIN - resource_id: - - rule: - type: OPPORTUNITY_ADMIN - resource_id: + type: SUBSPACE_ADMIN + resource_id: - name: user rules: - rule: type: SPACE_MEMBER - resource_id: - - rule: - type: CHALLENGE_MEMBER - resource_id: + resource_id: - rule: - type: OPPORTUNITY_MEMBER - resource_id: + type: SUBSPACE_MEMBER + resource_id: collaboration_whiteboard_created: - name: admin rules: @@ -266,22 +226,16 @@ recipients: type: SPACE_ADMIN resource_id: - rule: - type: CHALLENGE_ADMIN - resource_id: - - rule: - type: OPPORTUNITY_ADMIN - resource_id: + type: SUBSPACE_ADMIN + resource_id: - name: user rules: - rule: type: SPACE_MEMBER - resource_id: - - rule: - type: CHALLENGE_MEMBER - resource_id: + resource_id: - rule: - type: OPPORTUNITY_MEMBER - resource_id: + type: SUBSPACE_MEMBER + resource_id: collaboration_post_comment: - name: owner rules: @@ -293,25 +247,19 @@ recipients: rules: - rule: type: SPACE_MEMBER - resource_id: - - rule: - type: CHALLENGE_MEMBER - resource_id: + resource_id: - rule: - type: OPPORTUNITY_MEMBER - resource_id: + type: SUBSPACE_MEMBER + resource_id: collaboration_callout_published: - name: user rules: - rule: type: SPACE_MEMBER - resource_id: - - rule: - type: CHALLENGE_MEMBER - resource_id: + resource_id: - rule: - type: OPPORTUNITY_MEMBER - resource_id: + type: SUBSPACE_MEMBER + resource_id: platform_user_registered: - name: admin rules: diff --git a/service/package-lock.json b/service/package-lock.json index 0c3bb6e9..17d51e98 100644 --- a/service/package-lock.json +++ b/service/package-lock.json @@ -1,16 +1,16 @@ { "name": "alkemio-notifications", - "version": "0.15.3", + "version": "0.16.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "alkemio-notifications", - "version": "0.15.3", + "version": "0.16.0", "license": "EUPL-1.2", "dependencies": { - "@alkemio/client-lib": "^0.27.0", - "@alkemio/notifications-lib": "^0.6.0", + "@alkemio/client-lib": "^0.28.0", + "@alkemio/notifications-lib": "^0.7.1", "@nestjs/common": "^8.0.5", "@nestjs/config": "^1.0.1", "@nestjs/core": "^8.0.5", @@ -65,9 +65,9 @@ } }, "node_modules/@alkemio/client-lib": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@alkemio/client-lib/-/client-lib-0.27.0.tgz", - "integrity": "sha512-Gv4Ku6ZVt8+aF1Nsi1GLVzm2fCzTroS6szKs3/qZIqcFLkgFWEKNpPqb3ROU09c2qVD5tJMmsb5Zdetc/abO2Q==", + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@alkemio/client-lib/-/client-lib-0.28.0.tgz", + "integrity": "sha512-eh0/ub2K40yup9k3S+7IFzC4BUvkwufOCyOmHbtiefy9Rt4cjlybvt/fZNy1TIbkBex4cHuiJoXPUeakQJNfwA==", "dependencies": { "@graphql-codegen/typescript-graphql-request": "^4.5.3", "@graphql-codegen/typescript-operations": "^2.5.3", @@ -185,9 +185,9 @@ } }, "node_modules/@alkemio/notifications-lib": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@alkemio/notifications-lib/-/notifications-lib-0.6.0.tgz", - "integrity": "sha512-Li0gcC9FFBXJMAPuLeCaGYJHd77CK2nSAYsOjti+qcZljNH9ht1exSvyA0U4ofhTFopDx+Kc85s10EeSTJLoVA==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@alkemio/notifications-lib/-/notifications-lib-0.7.1.tgz", + "integrity": "sha512-X2Ik8UKMXopV7qGUxKhAJLLI9RekjatTXps5L1v1C3shLwT7hOtnaw7+fTU3/E6aYY9TMWPm+39l56HIFi28RA==", "engines": { "node": ">=16.15.0", "npm": ">=8.5.5" @@ -14600,9 +14600,9 @@ }, "dependencies": { "@alkemio/client-lib": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@alkemio/client-lib/-/client-lib-0.27.0.tgz", - "integrity": "sha512-Gv4Ku6ZVt8+aF1Nsi1GLVzm2fCzTroS6szKs3/qZIqcFLkgFWEKNpPqb3ROU09c2qVD5tJMmsb5Zdetc/abO2Q==", + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@alkemio/client-lib/-/client-lib-0.28.0.tgz", + "integrity": "sha512-eh0/ub2K40yup9k3S+7IFzC4BUvkwufOCyOmHbtiefy9Rt4cjlybvt/fZNy1TIbkBex4cHuiJoXPUeakQJNfwA==", "requires": { "@graphql-codegen/typescript-graphql-request": "^4.5.3", "@graphql-codegen/typescript-operations": "^2.5.3", @@ -14670,9 +14670,9 @@ } }, "@alkemio/notifications-lib": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@alkemio/notifications-lib/-/notifications-lib-0.6.0.tgz", - "integrity": "sha512-Li0gcC9FFBXJMAPuLeCaGYJHd77CK2nSAYsOjti+qcZljNH9ht1exSvyA0U4ofhTFopDx+Kc85s10EeSTJLoVA==" + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@alkemio/notifications-lib/-/notifications-lib-0.7.1.tgz", + "integrity": "sha512-X2Ik8UKMXopV7qGUxKhAJLLI9RekjatTXps5L1v1C3shLwT7hOtnaw7+fTU3/E6aYY9TMWPm+39l56HIFi28RA==" }, "@angular-devkit/core": { "version": "13.3.6", diff --git a/service/package.json b/service/package.json index 9f4ec00c..edb23946 100644 --- a/service/package.json +++ b/service/package.json @@ -1,6 +1,6 @@ { "name": "alkemio-notifications", - "version": "0.15.3", + "version": "0.16.0", "description": "Alkemio notifications service", "author": "Alkemio Foundation", "private": false, @@ -35,8 +35,8 @@ "validate-connection": "ts-node src/utils/validate-connection.ts" }, "dependencies": { - "@alkemio/client-lib": "^0.27.0", - "@alkemio/notifications-lib": "^0.6.0", + "@alkemio/client-lib": "^0.28.0", + "@alkemio/notifications-lib": "^0.7.1", "@nestjs/common": "^8.0.5", "@nestjs/config": "^1.0.1", "@nestjs/core": "^8.0.5", diff --git a/service/src/app.controller.ts b/service/src/app.controller.ts index 786c2243..8ac2b30c 100644 --- a/service/src/app.controller.ts +++ b/service/src/app.controller.ts @@ -23,9 +23,7 @@ import { CommunicationUserMentionEventPayload, CommunicationOrganizationMentionEventPayload, CommunicationUpdateEventPayload, - CollaborationContextReviewSubmittedPayload, CommunityNewMemberPayload, - CollaborationInterestPayload, PlatformUserRegistrationEventPayload, CollaborationCalloutPublishedEventPayload, BaseEventPayload, @@ -111,21 +109,6 @@ export class AppController { ); } - @EventPattern(NotificationEventType.COLLABORATION_INTEREST) - async sendCommunityCollaborationInterestNotification( - @Payload() eventPayload: CollaborationInterestPayload, - @Ctx() context: RmqContext - ) { - this.sendNotifications( - eventPayload, - context, - this.notificationService.sendCommunityCollaborationInterestNotification( - eventPayload - ), - NotificationEventType.COLLABORATION_INTEREST - ); - } - @EventPattern(NotificationEventType.PLATFORM_USER_REGISTERED) async sendUserRegisteredNotification( // todo is auto validation possible @@ -276,21 +259,6 @@ export class AppController { ); } - @EventPattern(NotificationEventType.COLLABORATION_CONTEXT_REVIEW_SUBMITTED) - async sendCommunityContextFeedbackNotifications( - @Payload() eventPayload: CollaborationContextReviewSubmittedPayload, - @Ctx() context: RmqContext - ) { - this.sendNotifications( - eventPayload, - context, - this.notificationService.sendCommunityContextFeedbackNotification( - eventPayload - ), - NotificationEventType.COLLABORATION_CONTEXT_REVIEW_SUBMITTED - ); - } - @EventPattern( NotificationEventType.COLLABORATION_WHITEBOARD_CREATED, Transport.RMQ diff --git a/service/src/app.module.ts b/service/src/app.module.ts index 209cacc3..47033b5e 100644 --- a/service/src/app.module.ts +++ b/service/src/app.module.ts @@ -15,9 +15,7 @@ import { AlkemioClientModule, NotifmeModule } from '@src/services/external'; import { PlatformForumDiscussionCreatedNotificationBuilder, CommunicationUpdateCreatedNotificationBuilder, - CollaborationContextReviewSubmittedNotificationBuilder, CommunityNewMemberNotificationBuilder, - CollaborationInterestNotificationBuilder, CollaborationPostCreatedNotificationBuilder, CollaborationPostCommentNotificationBuilder, CollaborationCalloutPublishedNotificationBuilder, @@ -32,7 +30,7 @@ import { } from './services/domain/builders'; import { NotificationService } from './services/domain/notification/notification.service'; import { - AlkemioUrlGeneratorModule, + AlkemioUrlGenerator, NotificationBuilder, } from './services/application'; import { CollaborationWhiteboardCreatedNotificationBuilder } from './services/domain/builders/collaboration-whiteboard-created/collaboration.whiteboard.created.notification.builder'; @@ -40,6 +38,7 @@ import { CollaborationDiscussionCommentNotificationBuilder } from './services/do import { CommunityInvitationCreatedNotificationBuilder } from './services/domain/builders/community-invitation-created/community.invitation.created.notification.builder'; import { CommentReplyNotificationBuilder } from './services/domain/builders/comment-reply/comment.reply.notification.builder'; import { CommunityExternalInvitationCreatedNotificationBuilder } from './services/domain/builders/community-external-invitation-created/community.external.invitation.created.notification.builder'; +import { AlkemioUrlGeneratorModule } from './services/application/alkemio-url-generator/alkemio.url.generator.module'; @Module({ imports: [ @@ -63,6 +62,7 @@ import { CommunityExternalInvitationCreatedNotificationBuilder } from './service useClass: HttpExceptionsFilter, }, NotificationBuilder, + AlkemioUrlGenerator, CommunityApplicationCreatedNotificationBuilder, CommunityInvitationCreatedNotificationBuilder, CommunityExternalInvitationCreatedNotificationBuilder, @@ -76,9 +76,7 @@ import { CommunityExternalInvitationCreatedNotificationBuilder } from './service CommunicationCommunityLeadsMessageNotificationBuilder, CommunicationUserMentionNotificationBuilder, CommunicationOrganizationMentionNotificationBuilder, - CollaborationContextReviewSubmittedNotificationBuilder, CommunityNewMemberNotificationBuilder, - CollaborationInterestNotificationBuilder, CollaborationWhiteboardCreatedNotificationBuilder, CollaborationPostCreatedNotificationBuilder, CollaborationPostCommentNotificationBuilder, diff --git a/service/src/common/email-template-payload/base.journey.email.payload.ts b/service/src/common/email-template-payload/base.journey.email.payload.ts index 320e04c4..044046bc 100644 --- a/service/src/common/email-template-payload/base.journey.email.payload.ts +++ b/service/src/common/email-template-payload/base.journey.email.payload.ts @@ -1,10 +1,10 @@ -import { JourneyType } from '@alkemio/notifications-lib'; +import { SpaceType } from '@alkemio/notifications-lib'; import { BaseEmailPayload } from './base.email.payload'; export interface BaseJourneyEmailPayload extends BaseEmailPayload { - journey: { + space: { displayName: string; url: string; - type: JourneyType; + type: SpaceType; }; } diff --git a/service/src/common/email-template-payload/community.application.created.email.payload.ts b/service/src/common/email-template-payload/community.application.created.email.payload.ts index eae91d92..60e71087 100644 --- a/service/src/common/email-template-payload/community.application.created.email.payload.ts +++ b/service/src/common/email-template-payload/community.application.created.email.payload.ts @@ -8,5 +8,5 @@ export interface CommunityApplicationCreatedEmailPayload email: string; profile: string; }; - journeyAdminURL: string; + spaceAdminURL: string; } diff --git a/service/src/common/email-template-payload/community.external.invitation.created.email.payload.ts b/service/src/common/email-template-payload/community.external.invitation.created.email.payload.ts index 048c456e..26679ea7 100644 --- a/service/src/common/email-template-payload/community.external.invitation.created.email.payload.ts +++ b/service/src/common/email-template-payload/community.external.invitation.created.email.payload.ts @@ -10,5 +10,5 @@ export interface CommunityExternalInvitationCreatedEmailPayload }; welcomeMessage?: string; emails?: string; - journeyAdminURL: string; + spaceAdminURL: string; } diff --git a/service/src/common/email-template-payload/community.invitation.created.email.payload.ts b/service/src/common/email-template-payload/community.invitation.created.email.payload.ts index 3fa2c21c..a8280363 100644 --- a/service/src/common/email-template-payload/community.invitation.created.email.payload.ts +++ b/service/src/common/email-template-payload/community.invitation.created.email.payload.ts @@ -8,5 +8,5 @@ export interface CommunityInvitationCreatedEmailPayload email: string; profile: string; }; - journeyAdminURL: string; + spaceAdminURL: string; } diff --git a/service/src/core/models/user.ts b/service/src/core/models/user.ts index 3341185b..c7cd02ed 100644 --- a/service/src/core/models/user.ts +++ b/service/src/core/models/user.ts @@ -8,6 +8,7 @@ export type User = { profile: { id: string; displayName: string; + url: string; }; }; @@ -21,6 +22,7 @@ export type InternalUser = { profile: { id: string; displayName: string; + url: string; }; }; @@ -30,7 +32,9 @@ export type ExternalUser = { email: string; }; -export const isUser = (user: User | ExternalUser): user is User => { +export const isExistingAlkemioUser = ( + user: User | ExternalUser +): user is User => { return (user as User).nameID !== undefined; }; diff --git a/service/src/services/application/alkemio-url-generator/alkemio.url.generator.module.ts b/service/src/services/application/alkemio-url-generator/alkemio.url.generator.module.ts index 84e6db8a..77894813 100644 --- a/service/src/services/application/alkemio-url-generator/alkemio.url.generator.module.ts +++ b/service/src/services/application/alkemio-url-generator/alkemio.url.generator.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; import { ALKEMIO_URL_GENERATOR } from '@common/enums'; -import { AlkemioUrlGenerator } from '.'; +import { AlkemioUrlGenerator } from './alkemio.url.generator'; @Module({ imports: [], diff --git a/service/src/services/application/alkemio-url-generator/alkemio.url.generator.ts b/service/src/services/application/alkemio-url-generator/alkemio.url.generator.ts index ab196b89..eca9affc 100644 --- a/service/src/services/application/alkemio-url-generator/alkemio.url.generator.ts +++ b/service/src/services/application/alkemio-url-generator/alkemio.url.generator.ts @@ -1,79 +1,13 @@ -import { Inject, Injectable, LoggerService } from '@nestjs/common'; -import { ConfigurationTypes } from '@common/enums'; -import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; -import { ConfigService } from '@nestjs/config'; -import { - JourneyPayload, - createJourneyURL as libCreateJourneyURL, - createJourneyAdminCommunityURL as libCreateJourneyAdminCommunityURL, - createUserURL as libCreateUserURL, - createCalloutURL as libCreateCalloutURL, - createPostURL as libCreatePostURL, - createWhiteboardURL as libCreateWhiteboardURL, - createOrganizationURL as libCreateOrganizationURL, - createUserNotificationPreferencesURL as libCreateUserNotificationPreferencesURL, -} from '@alkemio/notifications-lib'; -import { ExternalUser, User, isUser } from '@src/core/models'; +import { Injectable } from '@nestjs/common'; +import { ExternalUser, User, isExistingAlkemioUser } from '@src/core/models'; @Injectable() export class AlkemioUrlGenerator { - webclientEndpoint: string; - constructor( - @Inject(WINSTON_MODULE_NEST_PROVIDER) - private readonly logger: LoggerService, - private configService: ConfigService - ) { - this.webclientEndpoint = this.configService.get( - ConfigurationTypes.ALKEMIO - )?.webclient_endpoint; - } - - createPlatformURL(): string { - return this.webclientEndpoint; - } - - createJourneyURL(journey: JourneyPayload): string { - return libCreateJourneyURL(this.webclientEndpoint, journey); - } - - createJourneyAdminCommunityURL(journey: JourneyPayload): string { - return libCreateJourneyAdminCommunityURL(this.webclientEndpoint, journey); - } - - createUserURL(userNameID: string): string { - return libCreateUserURL(this.webclientEndpoint, userNameID); - } - - createCalloutURL(journeyURL: string, calloutNameID: string): string { - return libCreateCalloutURL(journeyURL, calloutNameID); - } - - createPostURL( - journeyURL: string, - calloutNameID: string, - postNameID: string - ): string { - return libCreatePostURL(journeyURL, calloutNameID, postNameID); - } - - createWhiteboardURL( - journeyURL: string, - calloutNameID: string, - whiteboardNameID: string - ): string { - return libCreateWhiteboardURL(journeyURL, calloutNameID, whiteboardNameID); - } - - createOrganizationURL(orgNameID: string): string { - return libCreateOrganizationURL(this.webclientEndpoint, orgNameID); - } - createUserNotificationPreferencesURL(user: User | ExternalUser): string { - return isUser(user) - ? libCreateUserNotificationPreferencesURL( - this.webclientEndpoint, - user.nameID - ) - : ''; + if (!isExistingAlkemioUser(user)) { + return ''; + } + const userProfileURL = (user as User).profile.url; + return `${userProfileURL}/settings/notifications`; } } diff --git a/service/src/services/application/alkemio-url-generator/index.ts b/service/src/services/application/alkemio-url-generator/index.ts deleted file mode 100644 index dbbc3dcc..00000000 --- a/service/src/services/application/alkemio-url-generator/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './alkemio.url.generator'; -export * from './alkemio.url.generator.module'; diff --git a/service/src/services/application/index.ts b/service/src/services/application/index.ts index 88acdd32..738cfdd8 100644 --- a/service/src/services/application/index.ts +++ b/service/src/services/application/index.ts @@ -1,5 +1,5 @@ export * from './notification-builder'; export * from './alkemio-client-adapter'; -export * from './alkemio-url-generator'; +export * from './alkemio-url-generator/alkemio.url.generator'; export * from './notification-recipients-adapter'; export * from './template-to-credential-mapper'; diff --git a/service/src/services/domain/builders/collaboration-callout-published/collaboration.callout.published.notification.builder.ts b/service/src/services/domain/builders/collaboration-callout-published/collaboration.callout.published.notification.builder.ts index 54fa7905..1c1c2394 100644 --- a/service/src/services/domain/builders/collaboration-callout-published/collaboration.callout.published.notification.builder.ts +++ b/service/src/services/domain/builders/collaboration-callout-published/collaboration.callout.published.notification.builder.ts @@ -1,18 +1,14 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { INotificationBuilder } from '@core/contracts'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '@src/services/application'; +import { NotificationBuilder, RoleConfig } from '@src/services/application'; import { NotificationTemplateType } from '@src/types'; import { UserPreferenceType } from '@alkemio/client-lib'; import { ExternalUser, User } from '@core/models'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; import { EmailTemplate } from '@common/enums/email.template'; import { CollaborationCalloutPublishedEventPayload } from '@alkemio/notifications-lib'; import { CollaborationCalloutPublishedEmailPayload } from '@common/email-template-payload'; import { NotificationEventType } from '@alkemio/notifications-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CollaborationCalloutPublishedNotificationBuilder @@ -23,7 +19,6 @@ export class CollaborationCalloutPublishedNotificationBuilder CollaborationCalloutPublishedEventPayload, CollaborationCalloutPublishedEmailPayload >, - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator ) {} build( @@ -38,10 +33,7 @@ export class CollaborationCalloutPublishedNotificationBuilder ]; const templateVariables = { - journeyID: - payload.journey?.challenge?.opportunity?.id ?? - payload.journey?.challenge?.id ?? - payload.journey.spaceID, + spaceID: payload.space.id, }; return this.notificationBuilder.build({ @@ -68,15 +60,7 @@ export class CollaborationCalloutPublishedNotificationBuilder const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioUrl = this.alkemioUrlGenerator.createPlatformURL(); - const journeyURL = this.alkemioUrlGenerator.createJourneyURL( - eventPayload.journey - ); - - const calloutURL = this.alkemioUrlGenerator.createCalloutURL( - journeyURL, - eventPayload.callout.nameID - ); + const calloutURL = eventPayload.callout.url; const result: CollaborationCalloutPublishedEmailPayload = { emailFrom: 'info@alkem.io', @@ -93,13 +77,13 @@ export class CollaborationCalloutPublishedNotificationBuilder url: calloutURL, type: eventPayload.callout.type, }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: this.alkemioUrlGenerator.createJourneyURL(eventPayload.journey), + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioUrl, + url: eventPayload.platform.url, }, }; return result; diff --git a/service/src/services/domain/builders/collaboration-context-feedback/collaboration.context.review.submitted.notification.builder.ts b/service/src/services/domain/builders/collaboration-context-feedback/collaboration.context.review.submitted.notification.builder.ts deleted file mode 100644 index b8d4df93..00000000 --- a/service/src/services/domain/builders/collaboration-context-feedback/collaboration.context.review.submitted.notification.builder.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { Inject, Injectable } from '@nestjs/common'; -import { NotificationEventType } from '@alkemio/notifications-lib'; -import { INotificationBuilder } from '@core/contracts'; -import { - CollaborationContextReviewSubmittedPayload, - FeedbackQuestions, -} from '@alkemio/notifications-lib'; -import { EmailTemplate } from '@common/enums/email.template'; -import { UserPreferenceType } from '@alkemio/client-lib'; -import { ExternalUser, User } from '@core/models'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '../../../application'; -import { NotificationTemplateType } from '@src/types'; -import { CollaborationContextReviewEmailPayload } from '@common/email-template-payload'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums'; - -@Injectable() -export class CollaborationContextReviewSubmittedNotificationBuilder - implements INotificationBuilder -{ - constructor( - @Inject(ALKEMIO_URL_GENERATOR) - private readonly alkemioUrlGenerator: AlkemioUrlGenerator, - private readonly notificationBuilder: NotificationBuilder< - CollaborationContextReviewSubmittedPayload, - CollaborationContextReviewEmailPayload - > - ) {} - - build( - payload: CollaborationContextReviewSubmittedPayload - ): Promise { - const roleConfig: RoleConfig[] = [ - { - role: 'admin', - emailTemplate: EmailTemplate.COLLABORATION_REVIEW_SUBMITTED_ADMIN, - preferenceType: - UserPreferenceType.NotificationCommunityReviewSubmittedAdmin, - }, - { - role: 'reviewer', - emailTemplate: EmailTemplate.COLLABORATION_REVIEW_SUBMITTED_REVIEWER, - preferenceType: UserPreferenceType.NotificationCommunityReviewSubmitted, - }, - ]; - - const templateVariables = { - userID: payload.triggeredBy, - challengeID: payload.journey.challenge?.id || '', - reviewerID: payload.triggeredBy, - }; - - return this.notificationBuilder.build({ - payload, - eventUserId: payload.triggeredBy, - roleConfig, - templateType: 'collaboration_review_submitted', - templateVariables, - templatePayloadBuilderFn: this.createTemplatePayload.bind(this), - }); - } - - createTemplatePayload( - eventPayload: CollaborationContextReviewSubmittedPayload, - recipient: User | ExternalUser, - reviewer?: User - ): CollaborationContextReviewEmailPayload { - if (!reviewer) { - throw Error( - `Reviewer not provided for '${NotificationEventType.COLLABORATION_CONTEXT_REVIEW_SUBMITTED}' event` - ); - } - - const notificationPreferenceURL = - this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); - - return { - emailFrom: 'info@alkem.io', - reviewer: { - name: reviewer.profile.displayName, - }, - recipient: { - firstName: recipient.firstName, - email: recipient.email, - notificationPreferences: notificationPreferenceURL, - }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: this.alkemioUrlGenerator.createJourneyURL(eventPayload.journey), - }, - review: toStringReview(eventPayload.questions), - platform: { - url: alkemioURL, - }, - }; - } -} - -const toStringReview = (questions: FeedbackQuestions[]): string => - questions.reduce( - (acc, curr) => acc.concat(`${curr.name}\n${curr.value}\n`), - '' - ); diff --git a/service/src/services/domain/builders/collaboration-discussion-comment/collaboration.discussion.comment.notification.builder.ts b/service/src/services/domain/builders/collaboration-discussion-comment/collaboration.discussion.comment.notification.builder.ts index 1b79f09c..1a70e60e 100644 --- a/service/src/services/domain/builders/collaboration-discussion-comment/collaboration.discussion.comment.notification.builder.ts +++ b/service/src/services/domain/builders/collaboration-discussion-comment/collaboration.discussion.comment.notification.builder.ts @@ -1,33 +1,29 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { UserPreferenceType } from '@alkemio/client-lib'; import { INotificationBuilder } from '@core/contracts'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '@src/services/application'; +import { NotificationBuilder, RoleConfig } from '@src/services/application'; import { NotificationTemplateType } from '@src/types'; import { EmailTemplate } from '@common/enums/email.template'; import { ExternalUser, User } from '@core/models'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; import { CollaborationDiscussionCommentEventPayload, NotificationEventType, } from '@alkemio/notifications-lib'; import { CollaborationDiscussionCommentEmailPayload } from '@src/common/email-template-payload'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CollaborationDiscussionCommentNotificationBuilder implements INotificationBuilder { constructor( + private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CollaborationDiscussionCommentEventPayload, CollaborationDiscussionCommentEmailPayload - >, - @Inject(ALKEMIO_URL_GENERATOR) - private readonly alkemioUrlGenerator: AlkemioUrlGenerator + > ) {} + build( payload: CollaborationDiscussionCommentEventPayload ): Promise { @@ -40,10 +36,7 @@ export class CollaborationDiscussionCommentNotificationBuilder ]; const templateVariables = { - journeyID: - payload.journey?.challenge?.opportunity?.id ?? - payload.journey?.challenge?.id ?? - payload.journey.spaceID, + spaceID: payload.space.id, }; return this.notificationBuilder.build({ @@ -69,21 +62,11 @@ export class CollaborationDiscussionCommentNotificationBuilder const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); - const journeyURL = this.alkemioUrlGenerator.createJourneyURL( - eventPayload.journey - ); - - const calloutURL = this.alkemioUrlGenerator.createCalloutURL( - journeyURL, - eventPayload.callout.nameID - ); - const result: CollaborationDiscussionCommentEmailPayload = { emailFrom: 'info@alkem.io', callout: { displayName: eventPayload.callout.displayName, - url: calloutURL, + url: eventPayload.callout.url, }, recipient: { @@ -95,13 +78,13 @@ export class CollaborationDiscussionCommentNotificationBuilder firstName: commentAuthor.firstName, email: commentAuthor.email, }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: journeyURL, + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, message: eventPayload.comment.message, }; diff --git a/service/src/services/domain/builders/collaboration-interest/collaboration.interest.notification.builder.ts b/service/src/services/domain/builders/collaboration-interest/collaboration.interest.notification.builder.ts deleted file mode 100644 index 6cffcf95..00000000 --- a/service/src/services/domain/builders/collaboration-interest/collaboration.interest.notification.builder.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { Inject, Injectable } from '@nestjs/common'; -import { UserPreferenceType } from '@alkemio/client-lib'; -import { INotificationBuilder } from '@core/contracts'; -import { ExternalUser, User } from '@core/models'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '../../../application'; -import { EmailTemplate } from '@common/enums/email.template'; -import { CollaborationInterestPayload } from '@alkemio/notifications-lib'; -import { NotificationTemplateType } from '@src/types'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; -import { CollaborationInterestEmailPayload } from '@common/email-template-payload'; -import { NotificationEventType } from '@alkemio/notifications-lib'; - -@Injectable() -export class CollaborationInterestNotificationBuilder - implements INotificationBuilder -{ - constructor( - @Inject(ALKEMIO_URL_GENERATOR) - private readonly alkemioUrlGenerator: AlkemioUrlGenerator, - private readonly notificationBuilder: NotificationBuilder< - CollaborationInterestPayload, - CollaborationInterestEmailPayload - > - ) {} - - build( - payload: CollaborationInterestPayload - ): Promise { - const roleConfig: RoleConfig[] = [ - { - role: 'admin', - preferenceType: - UserPreferenceType.NotificationCommunityCollaborationInterestAdmin, - emailTemplate: EmailTemplate.COLLABORATION_INTEREST_ADMIN, - }, - { - role: 'user', - preferenceType: - UserPreferenceType.NotificationCommunityCollaborationInterestUser, - emailTemplate: EmailTemplate.COLLABORATION_INTEREST_USER, - }, - ]; - - const templateVariables = { - userID: payload.triggeredBy, - spaceID: payload.journey.spaceID, - challengeID: payload.journey.challenge?.id ?? '', - opportunityID: payload.journey.challenge?.opportunity?.id ?? '', - }; - - return this.notificationBuilder.build({ - payload, - eventUserId: payload.triggeredBy, - roleConfig, - templateType: 'collaboration_interest', - templateVariables, - templatePayloadBuilderFn: this.createTemplatePayload.bind(this), - }); - } - - private createTemplatePayload( - eventPayload: CollaborationInterestPayload, - recipient: User | ExternalUser, - user?: User - ): CollaborationInterestEmailPayload { - if (!user) { - throw Error( - `Interested user not provided for '${NotificationEventType.COLLABORATION_INTEREST} event'` - ); - } - - const notificationPreferenceURL = - this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); - - return { - emailFrom: 'info@alkem.io', - user: { - name: user.profile.displayName, - }, - recipient: { - firstName: recipient.firstName, - email: recipient.email, - notificationPreferences: notificationPreferenceURL, - }, - relation: { - role: eventPayload.relation.role, - description: eventPayload.relation.description, - }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: this.alkemioUrlGenerator.createJourneyURL(eventPayload.journey), - }, - platform: { - url: alkemioURL, - }, - }; - } -} diff --git a/service/src/services/domain/builders/collaboration-post-comment/collaboration.post.comment.notification.builder.ts b/service/src/services/domain/builders/collaboration-post-comment/collaboration.post.comment.notification.builder.ts index 2c5cdd43..b1c70c6c 100644 --- a/service/src/services/domain/builders/collaboration-post-comment/collaboration.post.comment.notification.builder.ts +++ b/service/src/services/domain/builders/collaboration-post-comment/collaboration.post.comment.notification.builder.ts @@ -1,18 +1,14 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { UserPreferenceType } from '@alkemio/client-lib'; import { INotificationBuilder } from '@core/contracts'; import { CollaborationPostCommentEventPayload } from '@alkemio/notifications-lib'; import { CollaborationPostCommentEmailPayload } from '@common/email-template-payload'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '@src/services/application'; +import { NotificationBuilder, RoleConfig } from '@src/services/application'; import { NotificationTemplateType } from '@src/types'; import { EmailTemplate } from '@common/enums/email.template'; import { ExternalUser, User } from '@core/models'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; import { NotificationEventType } from '@alkemio/notifications-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CollaborationPostCommentNotificationBuilder @@ -23,7 +19,6 @@ export class CollaborationPostCommentNotificationBuilder CollaborationPostCommentEventPayload, CollaborationPostCommentEmailPayload >, - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator ) {} build( @@ -64,29 +59,15 @@ export class CollaborationPostCommentNotificationBuilder const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); - const journeyURL = this.alkemioUrlGenerator.createJourneyURL( - eventPayload.journey - ); - const postURL = this.alkemioUrlGenerator.createPostURL( - journeyURL, - eventPayload.callout.nameID, - eventPayload.post.nameID - ); - const calloutURL = this.alkemioUrlGenerator.createCalloutURL( - journeyURL, - eventPayload.callout.nameID - ); - return { emailFrom: 'info@alkem.io', callout: { displayName: eventPayload.callout.displayName, - url: calloutURL, + url: eventPayload.callout.url, }, post: { displayName: eventPayload.post.displayName, - url: postURL, + url: eventPayload.post.url, }, recipient: { firstName: recipient.firstName, @@ -97,13 +78,13 @@ export class CollaborationPostCommentNotificationBuilder firstName: commentAuthor.firstName, email: commentAuthor.email, }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: journeyURL, + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/collaboration-post-created/collaboration.post.created.notification.builder.ts b/service/src/services/domain/builders/collaboration-post-created/collaboration.post.created.notification.builder.ts index 2959819f..4809ffb0 100644 --- a/service/src/services/domain/builders/collaboration-post-created/collaboration.post.created.notification.builder.ts +++ b/service/src/services/domain/builders/collaboration-post-created/collaboration.post.created.notification.builder.ts @@ -1,18 +1,14 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { INotificationBuilder } from '@core/contracts'; import { UserPreferenceType } from '@alkemio/client-lib'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '@src/services/application'; +import { NotificationBuilder, RoleConfig } from '@src/services/application'; import { NotificationTemplateType } from '@src/types'; import { ExternalUser, User } from '@core/models'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; import { EmailTemplate } from '@common/enums/email.template'; import { CollaborationPostCreatedEmailPayload } from '@common/email-template-payload'; import { NotificationEventType } from '@alkemio/notifications-lib'; import { CollaborationPostCreatedEventPayload } from '@alkemio/notifications-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CollaborationPostCreatedNotificationBuilder @@ -23,7 +19,6 @@ export class CollaborationPostCreatedNotificationBuilder CollaborationPostCreatedEventPayload, CollaborationPostCreatedEmailPayload >, - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator ) {} build( @@ -42,24 +37,8 @@ export class CollaborationPostCreatedNotificationBuilder }, ]; - const spaceIDTemplateVar = - !payload.journey?.challenge?.opportunity?.id && - !payload.journey?.challenge?.id - ? payload.journey.spaceID - : ''; - - const challengeIDTemplateVar = !payload.journey?.challenge?.opportunity?.id - ? payload.journey?.challenge?.id - : undefined; - const templateVariables = { - spaceID: spaceIDTemplateVar, - challengeID: challengeIDTemplateVar ?? '', - opportunityID: payload.journey?.challenge?.opportunity?.id ?? '', - journeyID: - payload.journey?.challenge?.opportunity?.id ?? - payload.journey?.challenge?.id ?? - payload.journey.spaceID, + spaceID: payload.space.id, }; return this.notificationBuilder.build({ @@ -86,20 +65,6 @@ export class CollaborationPostCreatedNotificationBuilder const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); - const journeyURL = this.alkemioUrlGenerator.createJourneyURL( - eventPayload.journey - ); - const postURL = this.alkemioUrlGenerator.createPostURL( - journeyURL, - eventPayload.callout.nameID, - eventPayload.post.nameID - ); - const calloutURL = this.alkemioUrlGenerator.createCalloutURL( - journeyURL, - eventPayload.callout.nameID - ); - return { emailFrom: 'info@alkem.io', createdBy: { @@ -108,24 +73,24 @@ export class CollaborationPostCreatedNotificationBuilder }, callout: { displayName: eventPayload.callout.displayName, - url: calloutURL, + url: eventPayload.callout.url, }, post: { displayName: eventPayload.post.displayName, - url: postURL, + url: eventPayload.post.url, }, recipient: { firstName: recipient.firstName, email: recipient.email, notificationPreferences: notificationPreferenceURL, }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: journeyURL, + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/collaboration-whiteboard-created/collaboration.whiteboard.created.notification.builder.ts b/service/src/services/domain/builders/collaboration-whiteboard-created/collaboration.whiteboard.created.notification.builder.ts index b3359a71..8a49f624 100644 --- a/service/src/services/domain/builders/collaboration-whiteboard-created/collaboration.whiteboard.created.notification.builder.ts +++ b/service/src/services/domain/builders/collaboration-whiteboard-created/collaboration.whiteboard.created.notification.builder.ts @@ -1,18 +1,14 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { INotificationBuilder } from '@core/contracts'; import { CollaborationWhiteboardCreatedEventPayload } from '@alkemio/notifications-lib'; import { UserPreferenceType } from '@alkemio/client-lib'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '@src/services/application'; +import { NotificationBuilder, RoleConfig } from '@src/services/application'; import { NotificationTemplateType } from '@src/types'; import { ExternalUser, User } from '@core/models'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; import { EmailTemplate } from '@common/enums/email.template'; import { CollaborationWhiteboardCreatedEmailPayload } from '@common/email-template-payload'; import { NotificationEventType } from '@alkemio/notifications-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CollaborationWhiteboardCreatedNotificationBuilder @@ -23,7 +19,6 @@ export class CollaborationWhiteboardCreatedNotificationBuilder CollaborationWhiteboardCreatedEventPayload, CollaborationWhiteboardCreatedEmailPayload >, - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator ) {} build( @@ -42,24 +37,8 @@ export class CollaborationWhiteboardCreatedNotificationBuilder }, ]; - const spaceIDTemplateVar = - !payload.journey?.challenge?.opportunity?.id && - !payload.journey?.challenge?.id - ? payload.journey.spaceID - : ''; - - const challengeIDTemplateVar = !payload.journey?.challenge?.opportunity?.id - ? payload.journey?.challenge?.id - : undefined; - const templateVariables = { - spaceID: spaceIDTemplateVar, - challengeID: challengeIDTemplateVar ?? '', - opportunityID: payload.journey?.challenge?.opportunity?.id ?? '', - journeyID: - payload.journey?.challenge?.opportunity?.id ?? - payload.journey?.challenge?.id ?? - payload.journey.spaceID, + spaceID: payload.space.id, }; return this.notificationBuilder.build({ @@ -86,20 +65,6 @@ export class CollaborationWhiteboardCreatedNotificationBuilder const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); - const journeyURL = this.alkemioUrlGenerator.createJourneyURL( - eventPayload.journey - ); - const whiteboardURL = this.alkemioUrlGenerator.createWhiteboardURL( - journeyURL, - eventPayload.callout.nameID, - eventPayload.whiteboard.nameID - ); - const calloutURL = this.alkemioUrlGenerator.createCalloutURL( - journeyURL, - eventPayload.callout.nameID - ); - return { emailFrom: 'info@alkem.io', createdBy: { @@ -108,24 +73,24 @@ export class CollaborationWhiteboardCreatedNotificationBuilder }, callout: { displayName: eventPayload.callout.displayName, - url: calloutURL, + url: eventPayload.callout.url, }, whiteboard: { displayName: eventPayload.whiteboard.displayName, - url: whiteboardURL, + url: eventPayload.whiteboard.url, }, recipient: { firstName: recipient.firstName, email: recipient.email, notificationPreferences: notificationPreferenceURL, }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: journeyURL, + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/comment-reply/comment.reply.notification.builder.ts b/service/src/services/domain/builders/comment-reply/comment.reply.notification.builder.ts index c5abadf6..3475b894 100644 --- a/service/src/services/domain/builders/comment-reply/comment.reply.notification.builder.ts +++ b/service/src/services/domain/builders/comment-reply/comment.reply.notification.builder.ts @@ -1,23 +1,18 @@ -import { Injectable, Inject } from '@nestjs/common'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; +import { Injectable } from '@nestjs/common'; import { INotificationBuilder } from '@core/contracts'; import { ExternalUser, User } from '@core/models'; import { EmailTemplate } from '@common/enums/email.template'; import { CommentReplyEventPayload } from '@alkemio/notifications-lib'; import { UserPreferenceType } from '@alkemio/client-lib'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '../../../application'; +import { NotificationBuilder, RoleConfig } from '../../../application'; import { NotificationTemplateType } from '@src/types'; import { CommentReplyEmailPayload } from '@common/email-template-payload'; import { NotificationEventType } from '@alkemio/notifications-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommentReplyNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommentReplyEventPayload, @@ -64,13 +59,13 @@ export class CommentReplyNotificationBuilder implements INotificationBuilder { const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); + return { emailFrom: 'info@alkem.io', reply: { message: eventPayload.reply, createdBy: sender.profile.displayName, - createdByUrl: this.alkemioUrlGenerator.createUserURL(sender.nameID), + createdByUrl: sender.profile.url, }, comment: eventPayload.comment, recipient: { @@ -79,7 +74,7 @@ export class CommentReplyNotificationBuilder implements INotificationBuilder { notificationPreferences: notificationPreferenceURL, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/communication-community-message/communication.community.leads.message.notification.builder.ts b/service/src/services/domain/builders/communication-community-message/communication.community.leads.message.notification.builder.ts index 804fcd0f..71d1e3c9 100644 --- a/service/src/services/domain/builders/communication-community-message/communication.community.leads.message.notification.builder.ts +++ b/service/src/services/domain/builders/communication-community-message/communication.community.leads.message.notification.builder.ts @@ -1,23 +1,21 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { NotificationEventType, CommunicationCommunityLeadsMessageEventPayload, } from '@alkemio/notifications-lib'; import { ExternalUser, User } from '@core/models'; import { INotificationBuilder } from '@core/contracts/notification.builder.interface'; -import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator'; import { NotificationBuilder, RoleConfig } from '../../../application'; import { EmailTemplate } from '@common/enums/email.template'; import { NotificationTemplateType } from '@src/types/notification.template.type'; import { CommunicationCommunityLeadsMessageEmailPayload } from '@common/email-template-payload'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommunicationCommunityLeadsMessageNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommunicationCommunityLeadsMessageEventPayload, @@ -43,10 +41,7 @@ export class CommunicationCommunityLeadsMessageNotificationBuilder const templateVariables = { senderID: payload.triggeredBy, - journeyID: - payload.journey?.challenge?.opportunity?.id ?? - payload.journey?.challenge?.id ?? - payload.journey.spaceID, + spaceID: payload.space.id, }; return this.notificationBuilder.build({ @@ -71,10 +66,6 @@ export class CommunicationCommunityLeadsMessageNotificationBuilder } const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); - const journeyURL = this.alkemioUrlGenerator.createJourneyURL( - eventPayload.journey - ); return { emailFrom: 'info@alkem.io', @@ -89,13 +80,13 @@ export class CommunicationCommunityLeadsMessageNotificationBuilder notificationPreferences: notificationPreferenceURL, }, message: eventPayload.message, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: journeyURL, + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/communication-organization-mention/communication.organization.mention.notification.builder.ts b/service/src/services/domain/builders/communication-organization-mention/communication.organization.mention.notification.builder.ts index 167f18fb..9905f247 100644 --- a/service/src/services/domain/builders/communication-organization-mention/communication.organization.mention.notification.builder.ts +++ b/service/src/services/domain/builders/communication-organization-mention/communication.organization.mention.notification.builder.ts @@ -1,23 +1,21 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { NotificationEventType } from '@alkemio/notifications-lib'; import { ExternalUser, User } from '@core/models'; import { CommunicationOrganizationMentionEventPayload } from '@alkemio/notifications-lib'; import { INotificationBuilder } from '@core/contracts/notification.builder.interface'; -import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator'; import { NotificationBuilder, RoleConfig } from '../../../application'; import { EmailTemplate } from '@common/enums/email.template'; import { NotificationTemplateType } from '@src/types/notification.template.type'; import { CommunicationOrganizationMentionEmailPayload } from '@common/email-template-payload'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers'; import { UserPreferenceType } from '@alkemio/client-lib'; import { convertMarkdownToText } from '@src/utils/markdown-to-text.util'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommunicationOrganizationMentionNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommunicationOrganizationMentionEventPayload, @@ -62,7 +60,6 @@ export class CommunicationOrganizationMentionNotificationBuilder } const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); const htmlComment: string = convertMarkdownToText(eventPayload.comment); @@ -79,10 +76,10 @@ export class CommunicationOrganizationMentionNotificationBuilder }, comment: htmlComment, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, mentionedOrganization: { - displayName: eventPayload.mentionedOrganization.displayName, + displayName: eventPayload.mentionedOrganization.profile.displayName, }, commentOrigin: { url: eventPayload.commentOrigin.url, diff --git a/service/src/services/domain/builders/communication-organization-message/communication.organization.message.notification.builder.ts b/service/src/services/domain/builders/communication-organization-message/communication.organization.message.notification.builder.ts index 940111d1..82697450 100644 --- a/service/src/services/domain/builders/communication-organization-message/communication.organization.message.notification.builder.ts +++ b/service/src/services/domain/builders/communication-organization-message/communication.organization.message.notification.builder.ts @@ -1,24 +1,22 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { NotificationEventType, CommunicationOrganizationMessageEventPayload, } from '@alkemio/notifications-lib'; import { ExternalUser, User } from '@core/models'; import { INotificationBuilder } from '@core/contracts/notification.builder.interface'; -import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator'; import { NotificationBuilder, RoleConfig } from '../../../application'; import { EmailTemplate } from '@common/enums/email.template'; import { NotificationTemplateType } from '@src/types/notification.template.type'; import { CommunicationOrganizationMessageEmailPayload } from '@common/email-template-payload'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers'; import { UserPreferenceType } from '@alkemio/client-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommunicationOrganizationMessageNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommunicationOrganizationMessageEventPayload, @@ -69,7 +67,6 @@ export class CommunicationOrganizationMessageNotificationBuilder } const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); return { emailFrom: 'info@alkem.io', @@ -85,10 +82,10 @@ export class CommunicationOrganizationMessageNotificationBuilder }, message: eventPayload.message, organization: { - displayName: eventPayload.organization.displayName, + displayName: eventPayload.organization.profile.displayName, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/communication-update-created/communication.update.created.notification.builder.ts b/service/src/services/domain/builders/communication-update-created/communication.update.created.notification.builder.ts index 55af6936..3c767313 100644 --- a/service/src/services/domain/builders/communication-update-created/communication.update.created.notification.builder.ts +++ b/service/src/services/domain/builders/communication-update-created/communication.update.created.notification.builder.ts @@ -1,25 +1,20 @@ -import { Injectable, Inject } from '@nestjs/common'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; +import { Injectable } from '@nestjs/common'; import { INotificationBuilder } from '@core/contracts'; import { ExternalUser, User } from '@core/models'; import { EmailTemplate } from '@common/enums/email.template'; import { CommunicationUpdateEventPayload } from '@alkemio/notifications-lib'; import { UserPreferenceType } from '@alkemio/client-lib'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '../../../application'; +import { NotificationBuilder, RoleConfig } from '../../../application'; import { NotificationTemplateType } from '@src/types'; import { CommunicationUpdateCreatedEmailPayload } from '@common/email-template-payload'; import { NotificationEventType } from '@alkemio/notifications-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommunicationUpdateCreatedNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommunicationUpdateEventPayload, @@ -45,13 +40,7 @@ export class CommunicationUpdateCreatedNotificationBuilder ]; const templateVariables = { - spaceID: payload.journey.spaceID, - challengeID: payload.journey.challenge?.id ?? '', - opportunityID: payload.journey.challenge?.opportunity?.id ?? '', - journeyID: - payload.journey?.challenge?.opportunity?.id ?? - payload.journey?.challenge?.id ?? - payload.journey.spaceID, + spaceID: payload.space.id, }; return this.notificationBuilder.build({ @@ -77,7 +66,7 @@ export class CommunicationUpdateCreatedNotificationBuilder const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); + return { emailFrom: 'info@alkem.io', sender: { @@ -88,13 +77,13 @@ export class CommunicationUpdateCreatedNotificationBuilder email: recipient.email, notificationPreferences: notificationPreferenceURL, }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: this.alkemioUrlGenerator.createJourneyURL(eventPayload.journey), + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/communication-user-mention/communication.user.mention.notification.builder.ts b/service/src/services/domain/builders/communication-user-mention/communication.user.mention.notification.builder.ts index 32be9177..06409ca7 100644 --- a/service/src/services/domain/builders/communication-user-mention/communication.user.mention.notification.builder.ts +++ b/service/src/services/domain/builders/communication-user-mention/communication.user.mention.notification.builder.ts @@ -1,23 +1,21 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { NotificationEventType } from '@alkemio/notifications-lib'; import { ExternalUser, User } from '@core/models'; import { CommunicationUserMentionEventPayload } from '@alkemio/notifications-lib'; import { INotificationBuilder } from '@core/contracts/notification.builder.interface'; -import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator'; import { NotificationBuilder, RoleConfig } from '../../../application'; import { EmailTemplate } from '@common/enums/email.template'; import { NotificationTemplateType } from '@src/types/notification.template.type'; import { CommunicationUserMentionEmailPayload } from '@common/email-template-payload'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers'; import { UserPreferenceType } from '@alkemio/client-lib'; import { convertMarkdownToText } from '@src/utils/markdown-to-text.util'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommunicationUserMentionNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommunicationUserMentionEventPayload, @@ -63,7 +61,6 @@ export class CommunicationUserMentionNotificationBuilder } const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); const htmlComment: string = convertMarkdownToText(eventPayload.comment); @@ -80,7 +77,7 @@ export class CommunicationUserMentionNotificationBuilder }, comment: htmlComment, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, commentOrigin: { url: eventPayload.commentOrigin.url, diff --git a/service/src/services/domain/builders/communication-user-message/communication.user.message.notification.builder.ts b/service/src/services/domain/builders/communication-user-message/communication.user.message.notification.builder.ts index 31c37040..b9a6c792 100644 --- a/service/src/services/domain/builders/communication-user-message/communication.user.message.notification.builder.ts +++ b/service/src/services/domain/builders/communication-user-message/communication.user.message.notification.builder.ts @@ -1,22 +1,20 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { NotificationEventType } from '@alkemio/notifications-lib'; import { ExternalUser, User } from '@core/models'; import { CommunicationUserMessageEventPayload } from '@alkemio/notifications-lib'; import { INotificationBuilder } from '@core/contracts/notification.builder.interface'; -import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator'; import { NotificationBuilder, RoleConfig } from '../../../application'; import { EmailTemplate } from '@common/enums/email.template'; import { NotificationTemplateType } from '@src/types/notification.template.type'; import { CommunicationUserMessageEmailPayload } from '@common/email-template-payload'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers'; import { UserPreferenceType } from '@alkemio/client-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommunicationUserMessageNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommunicationUserMessageEventPayload, @@ -66,7 +64,6 @@ export class CommunicationUserMessageNotificationBuilder } const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); return { emailFrom: 'info@alkem.io', @@ -82,10 +79,10 @@ export class CommunicationUserMessageNotificationBuilder }, message: eventPayload.message, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, messageReceiver: { - displayName: eventPayload.messageReceiver.displayName, + displayName: eventPayload.messageReceiver.profile.displayName, }, }; } diff --git a/service/src/services/domain/builders/community-application-created/community.application.created.notification.builder.ts b/service/src/services/domain/builders/community-application-created/community.application.created.notification.builder.ts index e83ce660..82334674 100644 --- a/service/src/services/domain/builders/community-application-created/community.application.created.notification.builder.ts +++ b/service/src/services/domain/builders/community-application-created/community.application.created.notification.builder.ts @@ -1,25 +1,20 @@ -import { Injectable, Inject } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { NotificationEventType } from '@alkemio/notifications-lib'; import { INotificationBuilder } from '@core/contracts'; import { ExternalUser, User } from '@core/models'; import { CommunityApplicationCreatedEventPayload } from '@alkemio/notifications-lib'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '../../../application'; +import { NotificationBuilder, RoleConfig } from '../../../application'; import { NotificationTemplateType } from '@src/types'; import { UserPreferenceType } from '@alkemio/client-lib'; import { EmailTemplate } from '@common/enums/email.template'; import { CommunityApplicationCreatedEmailPayload } from '@common/email-template-payload'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommunityApplicationCreatedNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommunityApplicationCreatedEventPayload, @@ -42,26 +37,15 @@ export class CommunityApplicationCreatedNotificationBuilder preferenceType: UserPreferenceType.NotificationApplicationSubmitted, }, ]; - const spaceIDTemplateVar = - !payload.journey?.challenge?.opportunity?.id && - !payload.journey?.challenge?.id - ? payload.journey.spaceID - : ''; - - const challengeIDTemplateVar = !payload.journey?.challenge?.opportunity?.id - ? payload.journey?.challenge?.id - : undefined; const templateVariables = { - applicantID: payload.applicantID, - spaceID: spaceIDTemplateVar, - challengeID: challengeIDTemplateVar ?? '', - opportunityID: payload.journey.challenge?.opportunity?.id ?? '', + applicantID: payload.applicant.id, + spaceID: payload.space.id, }; return this.notificationBuilder.build({ payload, - eventUserId: payload.applicantID, + eventUserId: payload.applicant.id, roleConfig, templateType: 'community_application_created', templateVariables, @@ -79,40 +63,30 @@ export class CommunityApplicationCreatedNotificationBuilder `Applicant not provided for '${NotificationEventType.COMMUNITY_APPLICATION_CREATED} event'` ); } - const applicantProfileURL = this.alkemioUrlGenerator.createUserURL( - applicant.nameID - ); - const communityURL = this.alkemioUrlGenerator.createJourneyURL( - eventPayload.journey - ); - const communityAdminURL = - this.alkemioUrlGenerator.createJourneyAdminCommunityURL( - eventPayload.journey - ); + const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); return { emailFrom: 'info@alkem.io', applicant: { firstName: applicant.firstName, name: applicant.profile.displayName, email: applicant.email, - profile: applicantProfileURL, + profile: applicant.profile.url, }, - journeyAdminURL: communityAdminURL, + spaceAdminURL: eventPayload.space.adminURL, recipient: { firstName: recipient.firstName, email: recipient.email, notificationPreferences: notificationPreferenceURL, }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: communityURL, + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/community-external-invitation-created/community.external.invitation.created.notification.builder.ts b/service/src/services/domain/builders/community-external-invitation-created/community.external.invitation.created.notification.builder.ts index 7f20386f..3945b582 100644 --- a/service/src/services/domain/builders/community-external-invitation-created/community.external.invitation.created.notification.builder.ts +++ b/service/src/services/domain/builders/community-external-invitation-created/community.external.invitation.created.notification.builder.ts @@ -1,24 +1,19 @@ -import { Injectable, Inject } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { NotificationEventType } from '@alkemio/notifications-lib'; import { INotificationBuilder } from '@core/contracts'; import { ExternalUser, User } from '@core/models'; import { CommunityExternalInvitationCreatedEventPayload } from '@alkemio/notifications-lib'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '../../../application'; +import { NotificationBuilder, RoleConfig } from '../../../application'; import { NotificationTemplateType } from '@src/types'; import { EmailTemplate } from '@common/enums/email.template'; import { CommunityExternalInvitationCreatedEmailPayload } from '@common/email-template-payload'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommunityExternalInvitationCreatedNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommunityExternalInvitationCreatedEventPayload, @@ -42,9 +37,7 @@ export class CommunityExternalInvitationCreatedNotificationBuilder const templateVariables = { inviterID: payload.triggeredBy, - spaceID: payload.journey.spaceID, - challengeID: payload.journey.challenge?.id ?? '', - opportunityID: payload.journey.challenge?.opportunity?.id ?? '', + spaceID: payload.space.id, }; const externalUsers = payload.invitees.map(invitee => ({ @@ -74,19 +67,9 @@ export class CommunityExternalInvitationCreatedNotificationBuilder `Invitee not provided for '${NotificationEventType.COMMUNITY_INVITATION_CREATED} event'` ); } - const inviterProfileURL = this.alkemioUrlGenerator.createUserURL( - inviter.nameID - ); - const communityURL = this.alkemioUrlGenerator.createJourneyURL( - eventPayload.journey - ); - const communityAdminURL = - this.alkemioUrlGenerator.createJourneyAdminCommunityURL( - eventPayload.journey - ); + const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); const emails = [...eventPayload.invitees] .map(invitedUser => invitedUser.email) .join(', '); @@ -97,9 +80,9 @@ export class CommunityExternalInvitationCreatedNotificationBuilder firstName: inviter.firstName, name: inviter.profile.displayName, email: inviter.email, - profile: inviterProfileURL, + profile: inviter.profile.url, }, - journeyAdminURL: communityAdminURL, + spaceAdminURL: eventPayload.space.adminURL, recipient: { firstName: recipient.firstName, email: recipient.email, @@ -107,13 +90,13 @@ export class CommunityExternalInvitationCreatedNotificationBuilder }, emails: emails, welcomeMessage: eventPayload.welcomeMessage, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: communityURL, + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/community-invitation-created/community.invitation.created.notification.builder.ts b/service/src/services/domain/builders/community-invitation-created/community.invitation.created.notification.builder.ts index f8a99add..38b27d80 100644 --- a/service/src/services/domain/builders/community-invitation-created/community.invitation.created.notification.builder.ts +++ b/service/src/services/domain/builders/community-invitation-created/community.invitation.created.notification.builder.ts @@ -1,25 +1,20 @@ -import { Injectable, Inject } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { NotificationEventType } from '@alkemio/notifications-lib'; import { INotificationBuilder } from '@core/contracts'; import { ExternalUser, User } from '@core/models'; import { CommunityInvitationCreatedEventPayload } from '@alkemio/notifications-lib'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '../../../application'; +import { NotificationBuilder, RoleConfig } from '../../../application'; import { NotificationTemplateType } from '@src/types'; import { EmailTemplate } from '@common/enums/email.template'; import { CommunityInvitationCreatedEmailPayload } from '@common/email-template-payload'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers'; import { UserPreferenceType } from '@alkemio/client-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommunityInvitationCreatedNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommunityInvitationCreatedEventPayload, @@ -40,10 +35,8 @@ export class CommunityInvitationCreatedNotificationBuilder const templateVariables = { inviterID: payload.triggeredBy, - inviteeID: payload.inviteeID, - spaceID: payload.journey.spaceID, - challengeID: payload.journey.challenge?.id ?? '', - opportunityID: payload.journey.challenge?.opportunity?.id ?? '', + inviteeID: payload.invitee.id, + spaceID: payload.space.id, }; return this.notificationBuilder.build({ @@ -66,40 +59,31 @@ export class CommunityInvitationCreatedNotificationBuilder `Invitee not provided for '${NotificationEventType.COMMUNITY_INVITATION_CREATED} event'` ); } - const inviterProfileURL = this.alkemioUrlGenerator.createUserURL( - inviter.nameID - ); - const communityURL = this.alkemioUrlGenerator.createJourneyURL( - eventPayload.journey - ); - const communityAdminURL = - this.alkemioUrlGenerator.createJourneyAdminCommunityURL( - eventPayload.journey - ); + const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); + return { emailFrom: 'info@alkem.io', inviter: { firstName: inviter.firstName, name: inviter.profile.displayName, email: inviter.email, - profile: inviterProfileURL, + profile: inviter.profile.url, }, - journeyAdminURL: communityAdminURL, + spaceAdminURL: eventPayload.space.adminURL, recipient: { firstName: recipient.firstName, email: recipient.email, notificationPreferences: notificationPreferenceURL, }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: communityURL, + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/community-new-member/community.new.member.notification.builder.ts b/service/src/services/domain/builders/community-new-member/community.new.member.notification.builder.ts index 3c07fa3e..e74040be 100644 --- a/service/src/services/domain/builders/community-new-member/community.new.member.notification.builder.ts +++ b/service/src/services/domain/builders/community-new-member/community.new.member.notification.builder.ts @@ -1,30 +1,27 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { UserPreferenceType } from '@alkemio/client-lib'; import { INotificationBuilder } from '@core/contracts'; import { ExternalUser, User } from '@core/models'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '../../../application'; +import { NotificationBuilder, RoleConfig } from '../../../application'; import { EmailTemplate } from '@common/enums/email.template'; -import { CommunityNewMemberPayload } from '@alkemio/notifications-lib'; import { NotificationTemplateType } from '@src/types'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; import { CommunityNewMemberEmailPayload } from '@common/email-template-payload'; -import { NotificationEventType } from '@alkemio/notifications-lib'; +import { + CommunityNewMemberPayload, + NotificationEventType, +} from '@alkemio/notifications-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class CommunityNewMemberNotificationBuilder implements INotificationBuilder { constructor( + private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< CommunityNewMemberPayload, CommunityNewMemberEmailPayload - >, - @Inject(ALKEMIO_URL_GENERATOR) - private readonly alkemioUrlGenerator: AlkemioUrlGenerator + > ) {} build( @@ -43,26 +40,14 @@ export class CommunityNewMemberNotificationBuilder }, ]; - const spaceIDTemplateVar = - !payload.journey?.challenge?.opportunity?.id && - !payload.journey?.challenge?.id - ? payload.journey.spaceID - : ''; - - const challengeIDTemplateVar = !payload.journey?.challenge?.opportunity?.id - ? payload.journey?.challenge?.id - : undefined; - const templateVariables = { - memberID: payload.userID, - spaceID: spaceIDTemplateVar, - challengeID: challengeIDTemplateVar ?? '', - opportunityID: payload.journey.challenge?.opportunity?.id ?? '', + memberID: payload.user.id, + spaceID: payload.space.id, }; return this.notificationBuilder.build({ payload, - eventUserId: payload.userID, + eventUserId: payload.user.id, roleConfig, templateType: 'community_new_member', templateVariables, @@ -84,10 +69,7 @@ export class CommunityNewMemberNotificationBuilder const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); - const memberProfileURL = this.alkemioUrlGenerator.createUserURL( - member.nameID - ); + const memberProfileURL = member.profile.url; return { emailFrom: 'info@alkem.io', @@ -101,13 +83,13 @@ export class CommunityNewMemberNotificationBuilder email: recipient.email, notificationPreferences: notificationPreferenceURL, }, - journey: { - displayName: eventPayload.journey.displayName, - type: eventPayload.journey.type, - url: this.alkemioUrlGenerator.createJourneyURL(eventPayload.journey), + space: { + displayName: eventPayload.space.profile.displayName, + type: eventPayload.space.type, + url: eventPayload.space.profile.url, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/index.ts b/service/src/services/domain/builders/index.ts index ac554c5a..9663a1ea 100644 --- a/service/src/services/domain/builders/index.ts +++ b/service/src/services/domain/builders/index.ts @@ -7,9 +7,7 @@ export * from './communication-organization-message/communication.organization.m export * from './communication-community-message/communication.community.leads.message.notification.builder'; export * from './communication-user-mention/communication.user.mention.notification.builder'; export * from './communication-organization-mention/communication.organization.mention.notification.builder'; -export * from './collaboration-context-feedback/collaboration.context.review.submitted.notification.builder'; export * from './community-new-member/community.new.member.notification.builder'; -export * from './collaboration-interest/collaboration.interest.notification.builder'; export * from './platform-user-registered/platform.user.registered.notification.builder'; export * from './platform-user-removed/platform.user.removed.notification.builder'; export * from './platform-forum-discussion-comment/platform.forum.discussion.comment.notification.builder'; diff --git a/service/src/services/domain/builders/platform-forum-discussion-comment/platform.forum.discussion.comment.notification.builder.ts b/service/src/services/domain/builders/platform-forum-discussion-comment/platform.forum.discussion.comment.notification.builder.ts index 994dd053..498ca8bc 100644 --- a/service/src/services/domain/builders/platform-forum-discussion-comment/platform.forum.discussion.comment.notification.builder.ts +++ b/service/src/services/domain/builders/platform-forum-discussion-comment/platform.forum.discussion.comment.notification.builder.ts @@ -1,25 +1,20 @@ -import { Injectable, Inject } from '@nestjs/common'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; +import { Injectable } from '@nestjs/common'; import { INotificationBuilder } from '@core/contracts'; import { ExternalUser, User } from '@core/models'; import { EmailTemplate } from '@common/enums/email.template'; import { PlatformForumDiscussionCommentEventPayload } from '@alkemio/notifications-lib'; import { UserPreferenceType } from '@alkemio/client-lib'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '../../../application'; +import { NotificationBuilder, RoleConfig } from '../../../application'; import { NotificationTemplateType } from '@src/types'; import { PlatformForumDiscussionCommentEmailPayload } from '@common/email-template-payload'; import { NotificationEventType } from '@alkemio/notifications-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class PlatformForumDiscussionCommentNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< PlatformForumDiscussionCommentEventPayload, @@ -65,7 +60,6 @@ export class PlatformForumDiscussionCommentNotificationBuilder const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); return { emailFrom: 'info@alkem.io', comment: eventPayload.comment, @@ -76,7 +70,7 @@ export class PlatformForumDiscussionCommentNotificationBuilder notificationPreferences: notificationPreferenceURL, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/platform-forum-discussion-created/platform.forum.discussion.created.notification.builder.ts b/service/src/services/domain/builders/platform-forum-discussion-created/platform.forum.discussion.created.notification.builder.ts index b0f2a9c9..cae6eb94 100644 --- a/service/src/services/domain/builders/platform-forum-discussion-created/platform.forum.discussion.created.notification.builder.ts +++ b/service/src/services/domain/builders/platform-forum-discussion-created/platform.forum.discussion.created.notification.builder.ts @@ -1,25 +1,20 @@ -import { Injectable, Inject } from '@nestjs/common'; -import { ALKEMIO_URL_GENERATOR } from '@common/enums'; +import { Injectable } from '@nestjs/common'; import { INotificationBuilder } from '@core/contracts'; import { ExternalUser, User } from '@core/models'; import { EmailTemplate } from '@common/enums/email.template'; import { PlatformForumDiscussionCreatedEventPayload } from '@alkemio/notifications-lib'; import { UserPreferenceType } from '@alkemio/client-lib'; -import { - AlkemioUrlGenerator, - NotificationBuilder, - RoleConfig, -} from '../../../application'; +import { NotificationBuilder, RoleConfig } from '../../../application'; import { NotificationTemplateType } from '@src/types'; import { PlatformForumDiscussionCreatedEmailPayload } from '@common/email-template-payload'; import { NotificationEventType } from '@alkemio/notifications-lib'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class PlatformForumDiscussionCreatedNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< PlatformForumDiscussionCreatedEventPayload, @@ -63,7 +58,6 @@ export class PlatformForumDiscussionCreatedNotificationBuilder const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); return { emailFrom: 'info@alkem.io', createdBy: { @@ -79,7 +73,7 @@ export class PlatformForumDiscussionCreatedNotificationBuilder notificationPreferences: notificationPreferenceURL, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/platform-user-registered/platform.user.registered.notification.builder.ts b/service/src/services/domain/builders/platform-user-registered/platform.user.registered.notification.builder.ts index d708506e..59e69e37 100644 --- a/service/src/services/domain/builders/platform-user-registered/platform.user.registered.notification.builder.ts +++ b/service/src/services/domain/builders/platform-user-registered/platform.user.registered.notification.builder.ts @@ -1,22 +1,20 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { NotificationEventType } from '@alkemio/notifications-lib'; import { ExternalUser, User } from '@core/models'; import { PlatformUserRegistrationEventPayload } from '@alkemio/notifications-lib'; -import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator'; import { INotificationBuilder } from '@core/contracts/notification.builder.interface'; import { NotificationBuilder, RoleConfig } from '../../../application'; import { UserPreferenceType } from '@alkemio/client-lib'; import { EmailTemplate } from '@common/enums/email.template'; import { NotificationTemplateType } from '@src/types/notification.template.type'; import { PlatformUserRegisteredEmailPayload } from '@common/email-template-payload'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class PlatformUserRegisteredNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< PlatformUserRegistrationEventPayload, @@ -39,11 +37,11 @@ export class PlatformUserRegisteredNotificationBuilder }, ]; - const templateVariables = { registrantID: payload.userID }; + const templateVariables = { registrantID: payload.user.id }; return this.notificationBuilder.build({ payload, - eventUserId: payload.userID, + eventUserId: payload.user.id, roleConfig, templateType: 'platform_user_registered', templateVariables, @@ -62,19 +60,15 @@ export class PlatformUserRegisteredNotificationBuilder ); } - const registrantProfileURL = this.alkemioUrlGenerator.createUserURL( - registrant.nameID - ); const notificationPreferenceURL = this.alkemioUrlGenerator.createUserNotificationPreferencesURL(recipient); - const alkemioURL = this.alkemioUrlGenerator.createPlatformURL(); return { emailFrom: 'info@alkem.io', registrant: { displayName: registrant.profile.displayName, firstName: registrant.firstName, email: registrant.email, - profile: registrantProfileURL, + profile: registrant.profile.url, }, recipient: { firstName: recipient.firstName, @@ -82,7 +76,7 @@ export class PlatformUserRegisteredNotificationBuilder notificationPreferences: notificationPreferenceURL, }, platform: { - url: alkemioURL, + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/builders/platform-user-removed/platform.user.removed.notification.builder.ts b/service/src/services/domain/builders/platform-user-removed/platform.user.removed.notification.builder.ts index 72d37601..6dd793ec 100644 --- a/service/src/services/domain/builders/platform-user-removed/platform.user.removed.notification.builder.ts +++ b/service/src/services/domain/builders/platform-user-removed/platform.user.removed.notification.builder.ts @@ -1,21 +1,19 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { PlatformUserRemovedEventPayload } from '@alkemio/notifications-lib'; import { ExternalUser, User } from '@core/models'; -import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator'; import { INotificationBuilder } from '@core/contracts/notification.builder.interface'; import { NotificationBuilder, RoleConfig } from '../../../application'; import { UserPreferenceType } from '@alkemio/client-lib'; import { EmailTemplate } from '@common/enums/email.template'; import { NotificationTemplateType } from '@src/types/notification.template.type'; -import { ALKEMIO_URL_GENERATOR } from '@src/common/enums/providers'; import { PlatformUserRemovedEmailPayload } from '@src/common/email-template-payload/platform.user.removed.email.payload'; +import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator/alkemio.url.generator'; @Injectable() export class PlatformUserRemovedNotificationBuilder implements INotificationBuilder { constructor( - @Inject(ALKEMIO_URL_GENERATOR) private readonly alkemioUrlGenerator: AlkemioUrlGenerator, private readonly notificationBuilder: NotificationBuilder< PlatformUserRemovedEventPayload, @@ -64,7 +62,7 @@ export class PlatformUserRemovedNotificationBuilder notificationPreferences: notificationPreferenceURL, }, platform: { - url: this.alkemioUrlGenerator.createPlatformURL(), + url: eventPayload.platform.url, }, }; } diff --git a/service/src/services/domain/notification/notification.service.spec.ts b/service/src/services/domain/notification/notification.service.spec.ts index 2e943e11..5925a58d 100644 --- a/service/src/services/domain/notification/notification.service.spec.ts +++ b/service/src/services/domain/notification/notification.service.spec.ts @@ -1,10 +1,6 @@ import { Test } from '@nestjs/testing'; import { CommunityApplicationCreatedEventPayload } from '@alkemio/notifications-lib'; -import { - ALKEMIO_CLIENT_ADAPTER, - ALKEMIO_URL_GENERATOR, - NOTIFICATIONS_PROVIDER, -} from '@common/enums'; +import { ALKEMIO_CLIENT_ADAPTER, NOTIFICATIONS_PROVIDER } from '@common/enums'; import * as challengeAdminsData from '@test/data/challenge.admins.json'; import * as opportunityAdminsData from '@test/data/opportunity.admins.json'; import * as spaceAdminsData from '@test/data/space.admins.json'; @@ -24,11 +20,9 @@ import { CommunicationCommunityLeadsMessageNotificationBuilder, CommunicationUserMentionNotificationBuilder, CommunicationOrganizationMentionNotificationBuilder, - CollaborationContextReviewSubmittedNotificationBuilder, CommunityNewMemberNotificationBuilder, CollaborationPostCreatedNotificationBuilder, CollaborationPostCommentNotificationBuilder, - CollaborationInterestNotificationBuilder, CollaborationCalloutPublishedNotificationBuilder, PlatformUserRemovedNotificationBuilder, PlatformForumDiscussionCommentNotificationBuilder, @@ -36,7 +30,6 @@ import { CommentReplyNotificationBuilder, CommunityExternalInvitationCreatedNotificationBuilder, } from '../builders'; -import { AlkemioUrlGenerator } from '@src/services/application/alkemio-url-generator'; import { MockAlkemioClientAdapterProvider, MockConfigServiceProvider, @@ -45,7 +38,10 @@ import { MockNotifmeProvider, MockWinstonProvider, } from '@test/mocks'; -import { NotificationBuilder } from '@src/services/application'; +import { + AlkemioUrlGenerator, + NotificationBuilder, +} from '@src/services/application'; import { NotificationTemplateType } from '@src/types'; import { CollaborationWhiteboardCreatedNotificationBuilder } from '../builders/collaboration-whiteboard-created/collaboration.whiteboard.created.notification.builder'; import { CollaborationDiscussionCommentNotificationBuilder } from '../builders/collaboration-discussion-comment/collaboration.discussion.comment.notification.builder'; @@ -86,9 +82,7 @@ describe('NotificationService', () => { CommunicationCommunityLeadsMessageNotificationBuilder, CommunicationUserMentionNotificationBuilder, CommunicationOrganizationMentionNotificationBuilder, - CollaborationContextReviewSubmittedNotificationBuilder, CommunityNewMemberNotificationBuilder, - CollaborationInterestNotificationBuilder, CollaborationWhiteboardCreatedNotificationBuilder, CollaborationPostCreatedNotificationBuilder, CollaborationPostCommentNotificationBuilder, @@ -98,10 +92,7 @@ describe('NotificationService', () => { MockNotificationBuilderProvider, MockConfigServiceProvider, MockAlkemioClientAdapterProvider, - { - provide: ALKEMIO_URL_GENERATOR, - useClass: AlkemioUrlGenerator, - }, + AlkemioUrlGenerator, ], }).compile(); diff --git a/service/src/services/domain/notification/notification.service.ts b/service/src/services/domain/notification/notification.service.ts index 29e0e5d1..dc7c46c3 100644 --- a/service/src/services/domain/notification/notification.service.ts +++ b/service/src/services/domain/notification/notification.service.ts @@ -15,12 +15,10 @@ import { CommunicationCommunityLeadsMessageEventPayload, CommunicationUserMentionEventPayload, CommunicationOrganizationMentionEventPayload, - CollaborationContextReviewSubmittedPayload, PlatformUserRegistrationEventPayload, CommunityNewMemberPayload, CollaborationPostCreatedEventPayload, CollaborationPostCommentEventPayload, - CollaborationInterestPayload, CollaborationCalloutPublishedEventPayload, BaseEventPayload, PlatformUserRemovedEventPayload, @@ -39,10 +37,8 @@ import { CommunicationUpdateCreatedNotificationBuilder, PlatformUserRegisteredNotificationBuilder, PlatformForumDiscussionCommentNotificationBuilder, - CollaborationContextReviewSubmittedNotificationBuilder, CollaborationPostCreatedNotificationBuilder, CollaborationPostCommentNotificationBuilder, - CollaborationInterestNotificationBuilder as CollaborationInterestNotificationBuilder, CollaborationCalloutPublishedNotificationBuilder, CommunityNewMemberNotificationBuilder, CommunicationUserMessageNotificationBuilder, @@ -82,14 +78,12 @@ export class NotificationService { private communicationCommunityLeadsMessageNotificationBuilder: CommunicationCommunityLeadsMessageNotificationBuilder, private communicationUserMentionNotificationBuilder: CommunicationUserMentionNotificationBuilder, private communicationOrganizationMentionNotificationBuilder: CommunicationOrganizationMentionNotificationBuilder, - private collaborationContextReviewSubmittedNotificationBuilder: CollaborationContextReviewSubmittedNotificationBuilder, private communityNewMemberNotificationBuilder: CommunityNewMemberNotificationBuilder, private collaborationWhiteboardCreatedNotificationBuilder: CollaborationWhiteboardCreatedNotificationBuilder, private collaborationPostCreatedNotificationBuilder: CollaborationPostCreatedNotificationBuilder, private collaborationPostCommentNotificationBuilder: CollaborationPostCommentNotificationBuilder, private collaborationCalloutPublishedNotificationBuilder: CollaborationCalloutPublishedNotificationBuilder, private collaborationDiscussionCommentNotificationBuilder: CollaborationDiscussionCommentNotificationBuilder, - private collaborationInterestNotificationBuilder: CollaborationInterestNotificationBuilder, private commentReplyNotificationBuilder: CommentReplyNotificationBuilder ) {} @@ -241,15 +235,6 @@ export class NotificationService { ); } - async sendCommunityContextFeedbackNotification( - payload: CollaborationContextReviewSubmittedPayload - ): Promise[]> { - return this.sendNotifications( - payload, - this.collaborationContextReviewSubmittedNotificationBuilder - ); - } - async sendPostCreatedNotification( payload: CollaborationPostCreatedEventPayload ): Promise[]> { @@ -304,15 +289,6 @@ export class NotificationService { ); } - async sendCommunityCollaborationInterestNotification( - payload: CollaborationInterestPayload - ): Promise[]> { - return this.sendNotifications( - payload, - this.collaborationInterestNotificationBuilder - ); - } - private async sendNotification( notification: NotificationTemplateType ): Promise { diff --git a/service/src/templates/_layouts/email-transactional.html b/service/src/templates/_layouts/email-transactional.html index bfff9a05..b71d0cda 100644 --- a/service/src/templates/_layouts/email-transactional.html +++ b/service/src/templates/_layouts/email-transactional.html @@ -61,7 +61,7 @@ font-family: inherit; } .action-button { - background-color: #065f6b; + background-color: #1d384a; border: none; border-radius: 12px; color: white; diff --git a/service/src/templates/collaboration.callout.published.member.js b/service/src/templates/collaboration.callout.published.member.js index a107d3f7..3e1d5a3b 100644 --- a/service/src/templates/collaboration.callout.published.member.js +++ b/service/src/templates/collaboration.callout.published.member.js @@ -9,11 +9,11 @@ module.exports = () => ({ from: '{{emailFrom}}', to: '{{recipient.email}}', subject: - '{{journey.displayName}} - New {{callout.type}} is published "{{callout.displayName}}", have a look!', + '{{space.displayName}} - New {{callout.type}} is published "{{callout.displayName}}", have a look!', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %} Hi {{recipient.firstName}},

- {{publishedBy.firstName}} published a new {{callout.type}} in {{journey.type}}: "{{journey.displayName}}", with name: "{{callout.displayName}}". + {{publishedBy.firstName}} published a new {{callout.type}} in {{journey.type}}: "{{space.displayName}}", with name: "{{callout.displayName}}".

HAVE A LOOK! {% endblock %} diff --git a/service/src/templates/collaboration.discussion.comment.member.js b/service/src/templates/collaboration.discussion.comment.member.js index 583336cf..9db65897 100644 --- a/service/src/templates/collaboration.discussion.comment.member.js +++ b/service/src/templates/collaboration.discussion.comment.member.js @@ -4,18 +4,18 @@ var templates = require('./alkemio.template.blocks'); module.exports = () => ({ name: 'collaboration-discussion-comment-member', title: - '{{journey.displayName}} - New comment received on Callout: "{{callout.displayName}}"', + '{{space.displayName}} - New comment received on Callout: "{{callout.displayName}}"', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', subject: - '{{journey.displayName}} - New comment received on Callout "{{callout.displayName}}", have a look!', + '{{space.displayName}} - New comment received on Callout "{{callout.displayName}}", have a look!', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{createdBy.firstName}} commented on your {{callout.type}} '{{callout.displayName}}'. + {{createdBy.firstName}} commented on your {{callout.type}} '{{callout.displayName}}'.

HAVE A LOOK!

diff --git a/service/src/templates/collaboration.interest.admin.js b/service/src/templates/collaboration.interest.admin.js deleted file mode 100644 index 8319b694..00000000 --- a/service/src/templates/collaboration.interest.admin.js +++ /dev/null @@ -1,27 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const templates = require('./alkemio.template.blocks'); -/* eslint-disable quotes */ -module.exports = () => ({ - name: 'collaboration-interest-admin', - title: - '[{{journey.displayName}}] Interest to collaborate received from {{user.name}}', - version: 1, - channels: { - email: { - from: '{{emailFrom}}', - to: '{{recipient.email}}', - subject: - '[{{journey.displayName}}] Interest to collaborate received from {{user.name}}', - html: `{% extends "src/templates/_layouts/email-transactional.html" %} - {% block content %}Hi {{recipient.firstName}},

- - {{user.name}} is interested to participate in '{{journey.displayName}}' [{{journey.type}}]: - - role: {{relation.role}} - - description: {{relation.description}} -

- {% endblock %} - - ${templates.footerBlock}`, - }, - }, -}); diff --git a/service/src/templates/collaboration.interest.user.js b/service/src/templates/collaboration.interest.user.js deleted file mode 100644 index c1806b85..00000000 --- a/service/src/templates/collaboration.interest.user.js +++ /dev/null @@ -1,22 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -var templates = require('./alkemio.template.blocks'); -/* eslint-disable quotes */ -module.exports = () => ({ - name: 'collaboration-interest-user', - title: '{{journey.displayName}} - Your interest to collaborate was received!', - version: 1, - channels: { - email: { - from: '{{emailFrom}}', - to: '{{recipient.email}}', - subject: '{{user.name}} - Your interest to collaborate was received!', - html: `{% extends "src/templates/_layouts/email-transactional.html" %} - {% block content %}Hi {{user.name}},

- - Thank you for expressing the interest to collaborate on '{{journey.displayName}}' [{{journey.type}}]! -

- {% endblock %} - ${templates.footerBlock}`, - }, - }, -}); diff --git a/service/src/templates/collaboration.post.comment.owner.js b/service/src/templates/collaboration.post.comment.owner.js index 164973fc..3f4c5e36 100644 --- a/service/src/templates/collaboration.post.comment.owner.js +++ b/service/src/templates/collaboration.post.comment.owner.js @@ -4,18 +4,18 @@ var templates = require('./alkemio.template.blocks'); module.exports = () => ({ name: 'collaboration-post-comment-owner', title: - '{{journey.displayName}} - New comment received on your Post: "{{post.displayName}}"', + '{{space.displayName}} - New comment received on your Post: "{{post.displayName}}"', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', subject: - '{{journey.displayName}} - New comment received on your Post "{{post.displayName}}", have a look!', + '{{space.displayName}} - New comment received on your Post "{{post.displayName}}", have a look!', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{createdBy.firstName}} commented on your post titled: {{post.displayName}}. + {{createdBy.firstName}} commented on your post titled: {{post.displayName}}.

HAVE A LOOK!

diff --git a/service/src/templates/collaboration.post.created.admin.js b/service/src/templates/collaboration.post.created.admin.js index 98ee440b..5c92ccbc 100644 --- a/service/src/templates/collaboration.post.created.admin.js +++ b/service/src/templates/collaboration.post.created.admin.js @@ -3,19 +3,18 @@ var templates = require('./alkemio.template.blocks'); /* eslint-disable quotes */ module.exports = () => ({ name: 'collaboration-post-created-admin', - title: - '[{{journey.displayName}}] New Post created by {{createdBy.firstName}}', + title: '[{{space.displayName}}] New Post created by {{createdBy.firstName}}', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', subject: - '{{journey.displayName}}: New Post created by {{createdBy.firstName}}', + '{{space.displayName}}: New Post created by {{createdBy.firstName}}', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{createdBy.firstName}} created a new post: "{{post.displayName}}" in {{journey.displayName}}, of which you are an admin. + {{createdBy.firstName}} created a new post: "{{post.displayName}}" in {{space.displayName}}, of which you are an admin.

HAVE A LOOK!

{% endblock %} diff --git a/service/src/templates/collaboration.post.created.member.js b/service/src/templates/collaboration.post.created.member.js index 381c49bc..77a85e3c 100644 --- a/service/src/templates/collaboration.post.created.member.js +++ b/service/src/templates/collaboration.post.created.member.js @@ -4,18 +4,18 @@ var templates = require('./alkemio.template.blocks'); module.exports = () => ({ name: 'collaboration-post-created-member', title: - '{{journey.displayName}} - New Post created by {{createdBy.firstName}}, have a look!', + '{{space.displayName}} - New Post created by {{createdBy.firstName}}, have a look!', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', subject: - '{{journey.displayName}}: New Post created by {{createdBy.firstName}}, have a look!', + '{{space.displayName}}: New Post created by {{createdBy.firstName}}, have a look!', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{createdBy.firstName}} created a new post: "{{post.displayName}}". + {{createdBy.firstName}} created a new post: "{{post.displayName}}".

HAVE A LOOK!

{% endblock %} diff --git a/service/src/templates/collaboration.review.submitted.admin.js b/service/src/templates/collaboration.review.submitted.admin.js deleted file mode 100644 index 4c86023c..00000000 --- a/service/src/templates/collaboration.review.submitted.admin.js +++ /dev/null @@ -1,28 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const templates = require('./alkemio.template.blocks'); -/* eslint-disable quotes */ -module.exports = () => ({ - name: 'collaboration-review-submitted-admin', - title: - '[{{journey.displayName}}] Member {{reviewer.name}} submitted a review', - version: 1, - channels: { - email: { - from: '{{emailFrom}}', - to: '{{recipient.email}}', - subject: - '[{{journey.displayName}}] Member {{reviewer.name}} submitted a review', - html: `{% extends "src/templates/_layouts/email-transactional.html" %} - {% block content %}Hi {{recipient.firstName}}, - - The user {{reviewer.name}} of {{journey.displayName}} submitted the following review: - - {review} - - Sincerely yours, - {% endblock %} - - ${templates.footerBlock}`, - }, - }, -}); diff --git a/service/src/templates/collaboration.review.submitted.reviewer.js b/service/src/templates/collaboration.review.submitted.reviewer.js deleted file mode 100644 index d04a511e..00000000 --- a/service/src/templates/collaboration.review.submitted.reviewer.js +++ /dev/null @@ -1,26 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const templates = require('./alkemio.template.blocks'); -/* eslint-disable quotes */ -module.exports = () => ({ - name: 'collaboration-review-submitted-reviewer', - title: '{{journey.displayName}} - You have submitted a review', - version: 1, - channels: { - email: { - from: '{{emailFrom}}', - to: '{{recipient.email}}', - subject: '{{journey.displayName}} - You have submitted a review', - html: `{% extends "src/templates/_layouts/email-transactional.html" %} - {% block content %}Hi {{recipient.firstName}}, - - You have submitted a review about {{journey.displayName}}: - - {review} - - Sincerely yours, - {% endblock %} - - ${templates.footerBlock}`, - }, - }, -}); diff --git a/service/src/templates/collaboration.whiteboard.created.admin.js b/service/src/templates/collaboration.whiteboard.created.admin.js index 3a09fd8f..a15af12f 100644 --- a/service/src/templates/collaboration.whiteboard.created.admin.js +++ b/service/src/templates/collaboration.whiteboard.created.admin.js @@ -4,18 +4,18 @@ var templates = require('./alkemio.template.blocks'); module.exports = () => ({ name: 'collaboration-whiteboard-created-admin', title: - '[{{journey.displayName}}] New Whiteboard created by {{createdBy.firstName}}', + '[{{space.displayName}}] New Whiteboard created by {{createdBy.firstName}}', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', subject: - '{{journey.displayName}}: New Whiteboard created by {{createdBy.firstName}}', + '{{space.displayName}}: New Whiteboard created by {{createdBy.firstName}}', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{createdBy.firstName}} created a new whiteboard: "{{whiteboard.displayName}}" in {{journey.displayName}}, of which you are an admin. + {{createdBy.firstName}} created a new whiteboard: "{{whiteboard.displayName}}" in {{space.displayName}}, of which you are an admin.

HAVE A LOOK!

diff --git a/service/src/templates/collaboration.whiteboard.created.member.js b/service/src/templates/collaboration.whiteboard.created.member.js index 74e1cadc..1905f64b 100644 --- a/service/src/templates/collaboration.whiteboard.created.member.js +++ b/service/src/templates/collaboration.whiteboard.created.member.js @@ -4,18 +4,18 @@ var templates = require('./alkemio.template.blocks'); module.exports = () => ({ name: 'collaboration-whiteboard-created-member', title: - '{{journey.displayName}} - New Whiteboard created by {{createdBy.firstName}}, have a look!', + '{{space.displayName}} - New Whiteboard created by {{createdBy.firstName}}, have a look!', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', subject: - '{{journey.displayName}}: New Whiteboard created by {{createdBy.firstName}}, have a look!', + '{{space.displayName}}: New Whiteboard created by {{createdBy.firstName}}, have a look!', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{createdBy.firstName}} created a new whiteboard: "{{whiteboard.displayName}}". + {{createdBy.firstName}} created a new whiteboard: "{{whiteboard.displayName}}".

HAVE A LOOK!

{% endblock %} diff --git a/service/src/templates/comment.reply.js b/service/src/templates/comment.reply.js index 9c9206a2..85300bc5 100644 --- a/service/src/templates/comment.reply.js +++ b/service/src/templates/comment.reply.js @@ -13,7 +13,7 @@ module.exports = () => ({ html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{reply.createdBy}} replied to your comment on "{{comment.commentOrigin}}": + {{reply.createdBy}} replied to your comment on "{{comment.commentOrigin}}":

"{{reply.message}}"


diff --git a/service/src/templates/communication.comment.mention.organization.js b/service/src/templates/communication.comment.mention.organization.js index 3f3168f1..c4e0d750 100644 --- a/service/src/templates/communication.comment.mention.organization.js +++ b/service/src/templates/communication.comment.mention.organization.js @@ -15,7 +15,7 @@ module.exports = () => ({ html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{commentSender.displayName}} mentioned '{{mentionedOrganization.displayName}}' in a comment on '{{commentOrigin.displayName}}': + {{commentSender.displayName}} mentioned '{{mentionedOrganization.displayName}}' in a comment on '{{commentOrigin.displayName}}':
{{comment}}

diff --git a/service/src/templates/communication.comment.mention.user.js b/service/src/templates/communication.comment.mention.user.js index 4d70c61c..387f6b7d 100644 --- a/service/src/templates/communication.comment.mention.user.js +++ b/service/src/templates/communication.comment.mention.user.js @@ -15,7 +15,7 @@ module.exports = () => ({ html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{commentSender.displayName}} mentioned you in a comment on "{{commentOrigin.displayName}}": + {{commentSender.displayName}} mentioned you in a comment on "{{commentOrigin.displayName}}":
{{comment}}

diff --git a/service/src/templates/communication.community.leads.message.recipient.js b/service/src/templates/communication.community.leads.message.recipient.js index a388b6e8..d1080312 100644 --- a/service/src/templates/communication.community.leads.message.recipient.js +++ b/service/src/templates/communication.community.leads.message.recipient.js @@ -14,12 +14,12 @@ module.exports = () => ({ html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{messageSender.displayName}} sent a message to you in your role as a lead of '{{journey.displayName}}': + {{messageSender.displayName}} sent a message to you in your role as a lead of '{{space.displayName}}':
{{message}}

- You can reply to this email to respond directly to {{messageSender.firstName}}. - Please keep in mind that this way, your email address will become visible. + You can reply to this email to respond directly to {{messageSender.firstName}}. + Please keep in mind that this way, your email address will become visible. If you prefer to communicate through Alkemio, click on the envelope icon on {{messageSender.displayName}}'s profile.

{% endblock %} diff --git a/service/src/templates/communication.community.leads.message.sender.js b/service/src/templates/communication.community.leads.message.sender.js index a2121423..756531e5 100644 --- a/service/src/templates/communication.community.leads.message.sender.js +++ b/service/src/templates/communication.community.leads.message.sender.js @@ -9,15 +9,15 @@ module.exports = () => ({ email: { from: '{{emailFrom}}', to: '{{recipient.email}}', - subject: 'You have sent a message to {{journey.displayName}} community', + subject: 'You have sent a message to {{space.displayName}} community', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- You have sent the following message to the community lead(s) of {{journey.displayName}}: + You have sent the following message to the community lead(s) of {{space.displayName}}:
{{message}}

- + {% endblock %} ${templates.footerBlock}`, diff --git a/service/src/templates/communication.update.admin.js b/service/src/templates/communication.update.admin.js index 7a361048..08a53a03 100644 --- a/service/src/templates/communication.update.admin.js +++ b/service/src/templates/communication.update.admin.js @@ -3,19 +3,19 @@ var templates = require('./alkemio.template.blocks'); /* eslint-disable quotes */ module.exports = () => ({ name: 'communication-update-admin', - title: '[{{journey.displayName}}] New update shared', + title: '[{{space.displayName}}] New update shared', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', - subject: '{{journey.displayName}}: New update shared', + subject: '{{space.displayName}}: New update shared', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{sender.firstName}} shared a new update in {{journey.displayName}}, of which you are an admin. + {{sender.firstName}} shared a new update in {{space.displayName}}, of which you are an admin.

- HAVE A LOOK!

+ HAVE A LOOK!

{% endblock %} ${templates.footerBlock}`, diff --git a/service/src/templates/communication.update.member.js b/service/src/templates/communication.update.member.js index a20d1624..f71b35c9 100644 --- a/service/src/templates/communication.update.member.js +++ b/service/src/templates/communication.update.member.js @@ -3,19 +3,19 @@ var templates = require('./alkemio.template.blocks'); /* eslint-disable quotes */ module.exports = () => ({ name: 'communication-update-member', - title: '{{journey.displayName}} - New update, have a look!', + title: '{{space.displayName}} - New update, have a look!', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', - subject: '{{journey.displayName}} - New update, have a look!', + subject: '{{space.displayName}} - New update, have a look!', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{sender.firstName}} shared a new update in {{journey.displayName}}. + {{sender.firstName}} shared a new update in {{space.displayName}}.

- HAVE A LOOK!

+ HAVE A LOOK!

{% endblock %} ${templates.footerBlock}`, diff --git a/service/src/templates/communication.user.message.recipient.js b/service/src/templates/communication.user.message.recipient.js index d5b05837..e82503c6 100644 --- a/service/src/templates/communication.user.message.recipient.js +++ b/service/src/templates/communication.user.message.recipient.js @@ -17,9 +17,7 @@ module.exports = () => ({
{{message}}

- You can reply to this email to respond directly to {{messageSender.firstName}}. - Please keep in mind that this way, your email address will become visible. - If you prefer to communicate through Alkemio, click on the envelope icon on {{messageSender.displayName}}'s profile. + You can reply to this email to communicate directly with {{messageSender.firstName}}. Please note that your email address will become visible to the recipient.

{% endblock %} diff --git a/service/src/templates/community.external.invitation.created.invitee.js b/service/src/templates/community.external.invitation.created.invitee.js index bd4f2703..93d2810c 100644 --- a/service/src/templates/community.external.invitation.created.invitee.js +++ b/service/src/templates/community.external.invitation.created.invitee.js @@ -3,21 +3,21 @@ const templates = require('./alkemio.template.blocks'); /* eslint-disable quotes */ module.exports = () => ({ name: 'community-external-invitation-created-invitee', - title: '[{{journey.displayName}}] Invitation from {{inviter.name}}', + title: '[{{space.displayName}}] Invitation from {{inviter.name}}', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', - subject: 'Invitation to join {{journey.displayName}}', + subject: 'Invitation to join {{space.displayName}}', html: `{% extends "src/templates/_layouts/email-transactional.html" %} - {% block content %}{{inviter.firstName}} has invited you to join {{journey.displayName}} on Alkemio. + {% block content %}{{inviter.firstName}} has invited you to join {{space.displayName}} on Alkemio. {% if welcomeMessage %}
{{welcomeMessage}}
{% endif %}
- click here to accept or decline

+ click here to accept or decline

{% endblock %} ${templates.footerBlock}`, }, diff --git a/service/src/templates/community.external.invitation.created.inviter.js b/service/src/templates/community.external.invitation.created.inviter.js index 22bb5745..0080323c 100644 --- a/service/src/templates/community.external.invitation.created.inviter.js +++ b/service/src/templates/community.external.invitation.created.inviter.js @@ -3,16 +3,16 @@ const templates = require('./alkemio.template.blocks'); /* eslint-disable quotes */ module.exports = () => ({ name: 'community-external-invitation-created-inviter', - title: '[{{journey.displayName}}] Invitation sent', + title: '[{{space.displayName}}] Invitation sent', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', - subject: 'Invitation to join {{journey.displayName}}', + subject: 'Invitation to join {{space.displayName}}', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{inviter.name}},

- You have invited {{emails}} to join {{journey.displayName}}. + You have invited {{emails}} to join {{space.displayName}}. {% if welcomeMessage %}
{{welcomeMessage}}
diff --git a/service/src/templates/community.invitation.created.invitee.js b/service/src/templates/community.invitation.created.invitee.js index fcf425c4..4bbee966 100644 --- a/service/src/templates/community.invitation.created.invitee.js +++ b/service/src/templates/community.invitation.created.invitee.js @@ -3,20 +3,20 @@ const templates = require('./alkemio.template.blocks'); /* eslint-disable quotes */ module.exports = () => ({ name: 'community-invitation-created-invitee', - title: '[{{journey.displayName}}] Invitation from {{inviter.name}}', + title: '[{{space.displayName}}] Invitation from {{inviter.name}}', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', - subject: 'Invitation to join {{journey.displayName}}', + subject: 'Invitation to join {{space.displayName}}', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},
- {{inviter.firstName}} has invited you to join {{journey.displayName}}. + {{inviter.firstName}} has invited you to join {{space.displayName}}.
{{welcomeMessage}}

- click here to accept or decline

+ click here to accept or decline

{% endblock %} ${templates.footerBlock}`, }, diff --git a/service/src/templates/community.new.member.admin.js b/service/src/templates/community.new.member.admin.js index a647d8c9..eb347f9f 100644 --- a/service/src/templates/community.new.member.admin.js +++ b/service/src/templates/community.new.member.admin.js @@ -3,16 +3,16 @@ const templates = require('./alkemio.template.blocks'); /* eslint-disable quotes */ module.exports = () => ({ name: 'community-new-member-admin', - title: '{{member.name}} joined {{journey.displayName}}', + title: '{{member.name}} joined {{space.displayName}}', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', - subject: '{{member.name}} joined {{journey.displayName}}', + subject: '{{member.name}} joined {{space.displayName}}', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{member.name}} has joined {{journey.displayName}}, of which you are an admin. + {{member.name}} has joined {{space.displayName}}, of which you are an admin.

Have a look at {{member.name}}'s profile

{% endblock %} diff --git a/service/src/templates/community.new.member.member.js b/service/src/templates/community.new.member.member.js index c350f8c2..9221c96c 100644 --- a/service/src/templates/community.new.member.member.js +++ b/service/src/templates/community.new.member.member.js @@ -3,19 +3,19 @@ const templates = require('./alkemio.template.blocks'); /* eslint-disable quotes */ module.exports = () => ({ name: 'community-new-member-member', - title: '{{journey.displayName}} - You have joined this community', + title: '{{space.displayName}} - You have joined this community', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{member.email}}', - subject: '{{journey.displayName}} - Welcome to the Community!', + subject: '{{space.displayName}} - Welcome to the Community!', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- Thank you for joining {{journey.displayName}}! + Thank you for joining {{space.displayName}}! You can now start contributing to the various posts and whiteboards, further deepen your knowledge about this topic, and connect with other Contributors.

- HAVE A LOOK!

+ HAVE A LOOK!

{% endblock %} ${templates.footerBlock}`, }, diff --git a/service/src/templates/community.user.application.admin.js b/service/src/templates/community.user.application.admin.js index 8c4979e7..f87c3367 100644 --- a/service/src/templates/community.user.application.admin.js +++ b/service/src/templates/community.user.application.admin.js @@ -3,20 +3,20 @@ var templates = require('./alkemio.template.blocks'); /* eslint-disable quotes */ module.exports = () => ({ name: 'community-user-application-admin', - title: '[{{journey.displayName}}] Application from {{applicant.firstName}}', + title: '[{{space.displayName}}] Application from {{applicant.firstName}}', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', subject: - '{{journey.displayName}}: Application from {{applicant.firstName}}', + '{{space.displayName}}: Application from {{applicant.firstName}}', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- We have received an application from {{applicant.name}} for the {{journey.type}} {{journey.displayName}}, of which you are an admin. + We have received an application from {{applicant.name}} for the {{space.type}} {{space.displayName}}, of which you are an admin.
- Have a look at {{applicant.firstName}}'s profile

- Review {{applicant.firstName}}'s application on the Community tab on the settings page here. + Review {{applicant.firstName}}'s application

+ Have a look at {{applicant.firstName}}'s profile here.

{% endblock %} ${templates.footerBlock}`, diff --git a/service/src/templates/community.user.application.applicant.js b/service/src/templates/community.user.application.applicant.js index 9a89d525..03db37d5 100644 --- a/service/src/templates/community.user.application.applicant.js +++ b/service/src/templates/community.user.application.applicant.js @@ -3,19 +3,18 @@ var templates = require('./alkemio.template.blocks'); /* eslint-disable quotes */ module.exports = () => ({ name: 'community-user-application-applicant', - title: '{{journey.displayName}} - Your Application to join was received!', + title: '{{space.displayName}} - Your Application to join was received!', version: 1, channels: { email: { from: '{{emailFrom}}', to: '{{recipient.email}}', - subject: - '{{journey.displayName}} - Your Application to join was received!', + subject: '{{space.displayName}} - Your Application to join was received!', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{applicant.name}},

- We have received your application for the {{journey.type}} {{journey.displayName}}. + We have received your application for the {{space.type}} {{space.displayName}}. - Once your application is accepted, you will find this {{journey.type}} on your profile and homepage. As long as your application is pending, you can find it under "Pending Memberships" in your platform menu. + Once your application is accepted, you will find this {{space.type}} on your profile and homepage. As long as your application is pending, you can find it under "Pending Memberships" in your platform menu.

{% endblock %} ${templates.footerBlock}`, diff --git a/service/src/templates/platform.forum.discussion.comment.js b/service/src/templates/platform.forum.discussion.comment.js index bc3d7e39..b8460649 100644 --- a/service/src/templates/platform.forum.discussion.comment.js +++ b/service/src/templates/platform.forum.discussion.comment.js @@ -12,7 +12,7 @@ module.exports = () => ({ subject: 'New comment on discussion: {{discussion.displayName}}', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- A new comment has been added to {{discussion.displayName}}, the discussion you created in the Alkemio Forum + A new comment has been added to {{discussion.displayName}}, the discussion you created in the Alkemio Forum

HAVE A LOOK!

{% endblock %} diff --git a/service/src/templates/platform.forum.discussion.created.js b/service/src/templates/platform.forum.discussion.created.js index 6d8e082d..7cc1af48 100644 --- a/service/src/templates/platform.forum.discussion.created.js +++ b/service/src/templates/platform.forum.discussion.created.js @@ -12,7 +12,7 @@ module.exports = () => ({ subject: 'New discussion created: {{discussion.displayName}}', html: `{% extends "src/templates/_layouts/email-transactional.html" %} {% block content %}Hi {{recipient.firstName}},

- {{createdBy.firstName}} created a new discussion in the Alkemio Forum: "{{discussion.displayName}}" + {{createdBy.firstName}} created a new discussion in the Alkemio Forum: "{{discussion.displayName}}"

HAVE A LOOK!

{% endblock %} diff --git a/service/test/data/admin.user.json b/service/test/data/admin.user.json index 6c96b53b..346c0545 100644 --- a/service/test/data/admin.user.json +++ b/service/test/data/admin.user.json @@ -7,7 +7,8 @@ "email": "admin@alkem.io", "profile": { "id": "", - "displayName": "admin alkemio" + "displayName": "admin alkemio", + "url": "" }, "preferences": [ { diff --git a/service/test/data/challenge.admins.json b/service/test/data/challenge.admins.json index 3beca830..1e0c836d 100644 --- a/service/test/data/challenge.admins.json +++ b/service/test/data/challenge.admins.json @@ -8,7 +8,8 @@ "email": "Madalyn@Jerold.com", "profile": { "id": "", - "displayName": "Madalyn Jerold" + "displayName": "Madalyn Jerold", + "url": "" }, "preferences": [ { diff --git a/service/test/data/event.application.created.payload.json b/service/test/data/event.application.created.payload.json index c46bb1cc..b1f56b03 100644 --- a/service/test/data/event.application.created.payload.json +++ b/service/test/data/event.application.created.payload.json @@ -2,17 +2,22 @@ "pattern": "communityApplicationCreated", "data": { "triggeredBy": "f0a47bad-eca5-4942-84ac-4dc9f085b7b8", - "applicantID": "f0a47bad-eca5-4942-84ac-4dc9f085b7b8", - "journey": { - "displayName": "02 Zero Hunger", + "applicant": { + "id": "f0a47bad-eca5-4942-84ac-4dc9f085b7b8", + "profile": { + "url": "" + } + }, + "space": { "type": "challenge", - "spaceID": "32818605-ef2f-4395-bb49-1dc2835c23de", - "challenge": { - "id": "7b86f954-d8c3-4fac-a652-b922c80e5c20", - "opportunity": { - "id": "636be60f-b64a-4742-8b50-69e608601935" - } + "id": "32818605-ef2f-4395-bb49-1dc2835c23de", + "profile": { + "displayName": "02 Zero Hunger", + "url": "" } + }, + "platform": { + "url": "" } } } diff --git a/service/test/data/event.communication.discussion.created.payload.json b/service/test/data/event.communication.discussion.created.payload.json index 6b7e455a..1a35be84 100644 --- a/service/test/data/event.communication.discussion.created.payload.json +++ b/service/test/data/event.communication.discussion.created.payload.json @@ -12,13 +12,10 @@ "type": "challenge" }, "space": { - "id": "32818605-ef2f-4395-bb49-1dc2835c23de", - "challenge": { - "id": "7b86f954-d8c3-4fac-a652-b922c80e5c20", - "opportunity": { - "id": "636be60f-b64a-4742-8b50-69e608601935" - } - } + "id": "32818605-ef2f-4395-bb49-1dc2835c23de" + }, + "platform": { + "url": "" } } } diff --git a/service/test/data/event.communication.update.sent.json b/service/test/data/event.communication.update.sent.json index 26edf219..b1671b9f 100644 --- a/service/test/data/event.communication.update.sent.json +++ b/service/test/data/event.communication.update.sent.json @@ -10,13 +10,10 @@ "type": "challenge" }, "space": { - "id": "32818605-ef2f-4395-bb49-1dc2835c23de", - "challenge": { - "id": "7b86f954-d8c3-4fac-a652-b922c80e5c20", - "opportunity": { - "id": "636be60f-b64a-4742-8b50-69e608601935" - } - } + "id": "32818605-ef2f-4395-bb49-1dc2835c23de" + }, + "platform": { + "url": "" } } } diff --git a/service/test/data/event.user.registered.payload.json b/service/test/data/event.user.registered.payload.json index ca1664c5..e7a5929b 100644 --- a/service/test/data/event.user.registered.payload.json +++ b/service/test/data/event.user.registered.payload.json @@ -1,6 +1,11 @@ { "pattern": "userRegistered", "data": { - "userID": "f0a47bad-eca5-4942-84ac-4dc9f085b7b8" + "user": { + "id": "f0a47bad-eca5-4942-84ac-4dc9f085b7b8" + }, + "platform": { + "url": "" + } } } diff --git a/service/test/data/opportunity.admins.json b/service/test/data/opportunity.admins.json index fe87c2dd..b84d3071 100644 --- a/service/test/data/opportunity.admins.json +++ b/service/test/data/opportunity.admins.json @@ -8,7 +8,8 @@ "email": "Kathern@Keira.com", "profile": { "id": "", - "displayName": "Kathern Keira" + "displayName": "Kathern Keira", + "url": "" }, "preferences": [ { @@ -81,7 +82,8 @@ "email": "Madalyn@Jerold.com", "profile": { "id": "", - "displayName": "Madalyn Jerold" + "displayName": "Madalyn Jerold", + "url": "" }, "preferences": [ {