From 54bff7cd4a26f948d402973162cfd6a87abb1974 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 25 Oct 2023 10:37:39 +0300 Subject: [PATCH] [angular-16 | DONE | CHANGED]: Change email composer for Develop project (Add name, surname, email in mail body). --- utils/email/composer.ts | 43 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/utils/email/composer.ts b/utils/email/composer.ts index 216a1d59..4a2d35fd 100644 --- a/utils/email/composer.ts +++ b/utils/email/composer.ts @@ -1,6 +1,7 @@ import {Email} from "./email"; import {Body} from "./body"; import {properties} from "../../../../environments/environment"; +import {User} from "../../login/utils/helper.class"; export class Composer { private static noteBodySize = "14px"; @@ -48,7 +49,7 @@ export class Composer { public static composeEmailForNewCommunity(contactForm: any, admins: any): Email { let email: Email = new Email(); - + email.subject = "OpenAIRE - Connect"; email.body = "
" + "Name: " + contactForm.name + "
" @@ -61,10 +62,10 @@ export class Composer { email.recipients = admins; return email; } - + public static composeEmailForMonitor(contactForm: any, admins: string[]): Email { let email: Email = new Email(); - + email.subject = "OpenAIRE - Monitor"; email.body = "
" + "Name: " + contactForm.name + "
" @@ -93,21 +94,23 @@ export class Composer { return email; } - public static composeEmailForDevelop(contactForm: any, admins: any): Email { + public static composeEmailForDevelop(contactForm: any, admins: any, user: User): Email { let email: Email = new Email(); - email.subject = "OpenAIRE - Develop [" + properties.environment.toUpperCase() + "]"; email.body = "
" - + "Subject: " + (contactForm.subject ? contactForm.subject : '-') + "
" - + "

" + contactForm.message + "

" - + "
"; + + "Name: " + user.firstname + "
" + + "Surname: " + user.lastname + "
" + + "Email: " + user.email + "
" + + "Subject: " + (contactForm.subject ? contactForm.subject : '-') + "
" + + "

" + contactForm.message + "

" + + "
"; email.recipients = admins; return email; } public static composeEmailForUsageCounts(contactForm: any, admins: any): Email { let email: Email = new Email(); - + email.subject = "OpenAIRE - UsageCounts"; email.body = "
" + "Name: " + contactForm.name + "
" @@ -119,10 +122,10 @@ export class Composer { email.recipients = admins; return email; } - + public static composeEmailForGraph(contactForm: any, admins: any): Email { let email: Email = new Email(); - + email.subject = "OpenAIRE - Research Graph"; email.body = "
" + "Name: " + contactForm.name + "
" @@ -134,7 +137,7 @@ export class Composer { email.recipients = admins; return email; } - + public static composeEmailForFeedback(info: {name: string, url: string, email: string, issues: any[]}, recipients: string[]): Email { let email: Email = new Email(); email.subject = 'Feedback report for ' + info.name; @@ -173,7 +176,7 @@ export class Composer { email.recipients = recipients; return email; } - + public static composeEmailForUserAfterFeedback(recipients: string[]): Email { let email: Email = new Email(); email.subject = 'Feedback report received'; @@ -184,7 +187,7 @@ export class Composer { email.recipients = recipients; return email; } - + public static composeEmailToInformOldManagersForTheNewOnes(communityName: string, communityId: string) : Email { let email: Email = new Email(); @@ -233,7 +236,7 @@ export class Composer { + "
"; return email; } - + public static formatEmailBodyForInvitation(body: Body): string { let fromMessageAndName = ""; @@ -250,7 +253,7 @@ export class Composer { return formattedEmail; } - + // TODO remove this after adding this on admin public static initializeInvitationsBody(communityId: string, communityTitle: string, fullname: string): Body { let defaultMainBody = '

You are invited to join ' @@ -281,7 +284,7 @@ export class Composer { return {body: "", subject: this.subjectPrefix + communityTitle, recipients: []}; } - + public static composeEmailForMonitorDashboard(name: string, recipient: string, role: "manager" | "member") { let email: Email = new Email(); email.subject = 'OpenAIRE Monitor Dashboard | ' + name; @@ -289,7 +292,7 @@ export class Composer { email.recipient = recipient; return email; } - + public static composeMessageForMonitorDashboard(name: string, role: "manager" | "member", user: string = null, invitation: any = null) { let pdppLink = 'http://catalogue.openaire.eu/files/Personal%20Data%20Protection%20Policy%20for%20OpenAIRE%20Services%20April%202022.pdf'; let message = '

Dear ((__user__)),

' + @@ -313,7 +316,7 @@ export class Composer { } return message; } - + public static composeEmailForCommunityDashboard(name: string, role: "manager" | "member", recipient: string) { let email: Email = new Email(); email.subject = 'OpenAIRE Connect | ' + name; @@ -321,7 +324,7 @@ export class Composer { email.recipient = recipient; return email; } - + public static composeMessageForCommunityDashboard(name: string, role: "manager" | "member", user: string = null, invitation: any = null) { let message = '

Dear ((__user__)),

' + '

You have been invited to be a ' + role + ' of the OpenAIRE Research Community Dashboard for the ' + name + '.

' +