[angular-16 | DONE | CHANGED]: Change email composer for Develop project (Add name, surname, email in mail body).

This commit is contained in:
Konstantinos Triantafyllou 2023-10-25 10:37:39 +03:00
parent b69e19fa17
commit 54bff7cd4a
1 changed files with 23 additions and 20 deletions

View File

@ -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 = "<div style='font-size:" + this.noteBodySize + "'>"
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
@ -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 = "<div style='font-size:" + this.noteBodySize + "'>"
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
@ -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 = "<div style='font-size:" + this.noteBodySize + "'>"
+ "<span><b>Subject</b>: " + (contactForm.subject ? contactForm.subject : '-') + "</span><br>"
+ "<p>" + contactForm.message + "</p>"
+ "</div>";
+ "<span><b>Name</b>: " + user.firstname + "</span><br>"
+ "<span><b>Surname</b>: " + user.lastname + "</span><br>"
+ "<span><b>Email</b>: " + user.email + "</span><br>"
+ "<span><b>Subject</b>: " + (contactForm.subject ? contactForm.subject : '-') + "</span><br>"
+ "<p>" + contactForm.message + "</p>"
+ "</div>";
email.recipients = admins;
return email;
}
public static composeEmailForUsageCounts(contactForm: any, admins: any): Email {
let email: Email = new Email();
email.subject = "OpenAIRE - UsageCounts";
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
@ -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 = "<div style='font-size:" + this.noteBodySize + "'>"
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
@ -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 {
+ "</div>";
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 = '<p>You are invited to join <a href="https://' + (properties.environment == "production"?'':'beta.') + communityId + '.openaire.eu/">'
@ -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 = '<p>Dear ((__user__)),</p>' +
@ -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 = '<p>Dear ((__user__)),</p>' +
'<p>You have been invited to be a ' + role + ' of the OpenAIRE Research Community Dashboard for the ' + name + '.</p>' +