Add email initialization to composer and parameterize subject's prefix

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@54460 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-12-19 13:26:41 +00:00
parent 90fc009b7a
commit 91c27dcfb8
1 changed files with 21 additions and 11 deletions

View File

@ -7,8 +7,10 @@ export class Composer {
// TODO move to properties
private static openaireEmail = "mailto:openaire.test@gmail.com";
private static subjectPrefix = "[OpenAIRE-Connect] ";
private static closing = "OpenAIRE team"
private static openaireAddress = "<a href='https://www.openaire.eu'>www.openaire.eu</a><br>";
private static signature = "OpenAIRE team<br>" + Composer.openaireAddress;
private static signature = Composer.closing + "<br>" + Composer.openaireAddress;
private static ifYouAreNotResponsible(): string {
return "If you are not responsible for this community, please "
@ -28,7 +30,7 @@ export class Composer {
public static composeEmailForNewManager(communityId: string, communityName: string, newCommunityManagers: any): Email {
let email: Email = new Email();
email.subject = "[OpenAIRE-Connect] " + communityName + ": Welcome new manager";
email.subject = this.subjectPrefix + communityName + ": Welcome new manager";
email.body = "<div style='font-size:" + this.noteBodySize + "'><p>Welcome to OpenAIRE Connect!</p>"
+ "<p>You are receiving this e-mail as you were assigned as manager of the community <a href='https://beta."
+ communityId + ".openaire.eu/'>" + communityName + "</a> dashboard. "
@ -49,7 +51,7 @@ export class Composer {
public static composeEmailToInformOldManagersForTheNewOnes(communityName: string, communityId: string, firstVersionOfManagers: any, managers: any) : Email {
let email: Email = new Email();
email.subject = "[OpenAIRE-Connect] " + communityName + ": Managers list notification";
email.subject = this.subjectPrefix + communityName + ": Managers list notification";
email.body = "<div style='font-size:" + this.noteBodySize + "'>"
+ "<p>There are updates in the managers list for \"" + communityName + "\" community.<br>"
+ "The list of managers is: " + managers.join(', ') + "</p>"
@ -69,7 +71,7 @@ export class Composer {
public static composeEmailToInformManagers(communityName: string, communityId: string, managers: any): Email {
let email: Email = new Email();
email.subject = "[OpenAIRE-Connect] " + communityName + ": New subscriber notification";
email.subject = this.subjectPrefix + communityName + ": New subscriber notification";
email.body = "<div style='font-size" + this.noteBodySize + "'>"
+ "<p>There is a new subscriber for \"" + communityName + "\" community. Click "
+ "<a href='https://beta.admin.connect.openaire.eu/manage-subscribers?communityId="
@ -103,13 +105,21 @@ export class Composer {
return formattedEmail;
}
public static initializeInvitationEmailsBody(communityId: string, communityTitle: string): string {
return '<p>You are invited to subscribe to <a href="https://beta.' + communityId + '.openaire.eu/">'
+ communityTitle + '</a> dashboard.<br>'
+ 'The purpose of this dashboard is to gather, link &amp; monitor the research results related to your community.</p>'
+ '<p>The community dashboard is part of the <a href="https://connect.openaire.eu/">OpenAIRE-Connect</a> '
+ 'project and currently is in BETA version.'
+ '</p>';
public static initializeInvitationsBody(communityId: string, communityTitle: string, fullname: string): Body {
let body: Body = new Body();
let defaultMainBody = '<p>You are invited to subscribe to <a href="https://beta.' + communityId + '.openaire.eu/">'
+ communityTitle + '</a> dashboard.<br>'
+ 'The purpose of this dashboard is to gather, link &amp; monitor the research results related to your community.</p>'
+ '<p>The community dashboard is part of the <a href="https://connect.openaire.eu/">OpenAIRE-Connect</a> '
+ 'project and currently is in BETA version.'
+ '</p>';
return body = {fromMessage: ", on behalf of ", fromName: fullname, paragraphs: defaultMainBody, signature: this.closing, note: ""};
}
public static initializeInvitationsEmail(communityTitle: string) {
let email: Email = new Email();
return email = {body: "", subject: this.subjectPrefix + communityTitle, recipients: []};
}
}