[angular-16 | DONE | CHANGED]: Change email composer for Develop project (Add name, surname, email in mail body).
This commit is contained in:
parent
b69e19fa17
commit
54bff7cd4a
|
@ -1,6 +1,7 @@
|
||||||
import {Email} from "./email";
|
import {Email} from "./email";
|
||||||
import {Body} from "./body";
|
import {Body} from "./body";
|
||||||
import {properties} from "../../../../environments/environment";
|
import {properties} from "../../../../environments/environment";
|
||||||
|
import {User} from "../../login/utils/helper.class";
|
||||||
|
|
||||||
export class Composer {
|
export class Composer {
|
||||||
private static noteBodySize = "14px";
|
private static noteBodySize = "14px";
|
||||||
|
@ -48,7 +49,7 @@ export class Composer {
|
||||||
|
|
||||||
public static composeEmailForNewCommunity(contactForm: any, admins: any): Email {
|
public static composeEmailForNewCommunity(contactForm: any, admins: any): Email {
|
||||||
let email: Email = new Email();
|
let email: Email = new Email();
|
||||||
|
|
||||||
email.subject = "OpenAIRE - Connect";
|
email.subject = "OpenAIRE - Connect";
|
||||||
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
|
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
|
||||||
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
|
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
|
||||||
|
@ -61,10 +62,10 @@ export class Composer {
|
||||||
email.recipients = admins;
|
email.recipients = admins;
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static composeEmailForMonitor(contactForm: any, admins: string[]): Email {
|
public static composeEmailForMonitor(contactForm: any, admins: string[]): Email {
|
||||||
let email: Email = new Email();
|
let email: Email = new Email();
|
||||||
|
|
||||||
email.subject = "OpenAIRE - Monitor";
|
email.subject = "OpenAIRE - Monitor";
|
||||||
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
|
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
|
||||||
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
|
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
|
||||||
|
@ -93,21 +94,23 @@ export class Composer {
|
||||||
return email;
|
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();
|
let email: Email = new Email();
|
||||||
|
|
||||||
email.subject = "OpenAIRE - Develop [" + properties.environment.toUpperCase() + "]";
|
email.subject = "OpenAIRE - Develop [" + properties.environment.toUpperCase() + "]";
|
||||||
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
|
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
|
||||||
+ "<span><b>Subject</b>: " + (contactForm.subject ? contactForm.subject : '-') + "</span><br>"
|
+ "<span><b>Name</b>: " + user.firstname + "</span><br>"
|
||||||
+ "<p>" + contactForm.message + "</p>"
|
+ "<span><b>Surname</b>: " + user.lastname + "</span><br>"
|
||||||
+ "</div>";
|
+ "<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;
|
email.recipients = admins;
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static composeEmailForUsageCounts(contactForm: any, admins: any): Email {
|
public static composeEmailForUsageCounts(contactForm: any, admins: any): Email {
|
||||||
let email: Email = new Email();
|
let email: Email = new Email();
|
||||||
|
|
||||||
email.subject = "OpenAIRE - UsageCounts";
|
email.subject = "OpenAIRE - UsageCounts";
|
||||||
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
|
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
|
||||||
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
|
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
|
||||||
|
@ -119,10 +122,10 @@ export class Composer {
|
||||||
email.recipients = admins;
|
email.recipients = admins;
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static composeEmailForGraph(contactForm: any, admins: any): Email {
|
public static composeEmailForGraph(contactForm: any, admins: any): Email {
|
||||||
let email: Email = new Email();
|
let email: Email = new Email();
|
||||||
|
|
||||||
email.subject = "OpenAIRE - Research Graph";
|
email.subject = "OpenAIRE - Research Graph";
|
||||||
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
|
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
|
||||||
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
|
+ "<span><b>Name</b>: " + contactForm.name + "</span><br>"
|
||||||
|
@ -134,7 +137,7 @@ export class Composer {
|
||||||
email.recipients = admins;
|
email.recipients = admins;
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static composeEmailForFeedback(info: {name: string, url: string, email: string, issues: any[]}, recipients: string[]): Email {
|
public static composeEmailForFeedback(info: {name: string, url: string, email: string, issues: any[]}, recipients: string[]): Email {
|
||||||
let email: Email = new Email();
|
let email: Email = new Email();
|
||||||
email.subject = 'Feedback report for ' + info.name;
|
email.subject = 'Feedback report for ' + info.name;
|
||||||
|
@ -173,7 +176,7 @@ export class Composer {
|
||||||
email.recipients = recipients;
|
email.recipients = recipients;
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static composeEmailForUserAfterFeedback(recipients: string[]): Email {
|
public static composeEmailForUserAfterFeedback(recipients: string[]): Email {
|
||||||
let email: Email = new Email();
|
let email: Email = new Email();
|
||||||
email.subject = 'Feedback report received';
|
email.subject = 'Feedback report received';
|
||||||
|
@ -184,7 +187,7 @@ export class Composer {
|
||||||
email.recipients = recipients;
|
email.recipients = recipients;
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static composeEmailToInformOldManagersForTheNewOnes(communityName: string, communityId: string) : Email {
|
public static composeEmailToInformOldManagersForTheNewOnes(communityName: string, communityId: string) : Email {
|
||||||
let email: Email = new Email();
|
let email: Email = new Email();
|
||||||
|
|
||||||
|
@ -233,7 +236,7 @@ export class Composer {
|
||||||
+ "</div>";
|
+ "</div>";
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static formatEmailBodyForInvitation(body: Body): string {
|
public static formatEmailBodyForInvitation(body: Body): string {
|
||||||
let fromMessageAndName = "";
|
let fromMessageAndName = "";
|
||||||
|
|
||||||
|
@ -250,7 +253,7 @@ export class Composer {
|
||||||
|
|
||||||
return formattedEmail;
|
return formattedEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO remove this after adding this on admin
|
// TODO remove this after adding this on admin
|
||||||
public static initializeInvitationsBody(communityId: string, communityTitle: string, fullname: string): Body {
|
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/">'
|
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: []};
|
return {body: "", subject: this.subjectPrefix + communityTitle, recipients: []};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static composeEmailForMonitorDashboard(name: string, recipient: string, role: "manager" | "member") {
|
public static composeEmailForMonitorDashboard(name: string, recipient: string, role: "manager" | "member") {
|
||||||
let email: Email = new Email();
|
let email: Email = new Email();
|
||||||
email.subject = 'OpenAIRE Monitor Dashboard | ' + name;
|
email.subject = 'OpenAIRE Monitor Dashboard | ' + name;
|
||||||
|
@ -289,7 +292,7 @@ export class Composer {
|
||||||
email.recipient = recipient;
|
email.recipient = recipient;
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static composeMessageForMonitorDashboard(name: string, role: "manager" | "member", user: string = null, invitation: any = null) {
|
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 pdppLink = 'http://catalogue.openaire.eu/files/Personal%20Data%20Protection%20Policy%20for%20OpenAIRE%20Services%20April%202022.pdf';
|
||||||
let message = '<p>Dear ((__user__)),</p>' +
|
let message = '<p>Dear ((__user__)),</p>' +
|
||||||
|
@ -313,7 +316,7 @@ export class Composer {
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static composeEmailForCommunityDashboard(name: string, role: "manager" | "member", recipient: string) {
|
public static composeEmailForCommunityDashboard(name: string, role: "manager" | "member", recipient: string) {
|
||||||
let email: Email = new Email();
|
let email: Email = new Email();
|
||||||
email.subject = 'OpenAIRE Connect | ' + name;
|
email.subject = 'OpenAIRE Connect | ' + name;
|
||||||
|
@ -321,7 +324,7 @@ export class Composer {
|
||||||
email.recipient = recipient;
|
email.recipient = recipient;
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static composeMessageForCommunityDashboard(name: string, role: "manager" | "member", user: string = null, invitation: any = null) {
|
public static composeMessageForCommunityDashboard(name: string, role: "manager" | "member", user: string = null, invitation: any = null) {
|
||||||
let message = '<p>Dear ((__user__)),</p>' +
|
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>' +
|
'<p>You have been invited to be a ' + role + ' of the OpenAIRE Research Community Dashboard for the ' + name + '.</p>' +
|
||||||
|
|
Loading…
Reference in New Issue