Use composer

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@54353 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-12-13 11:50:07 +00:00
parent 3d6d94b99c
commit f1d415ab0b
1 changed files with 24 additions and 23 deletions

View File

@ -10,6 +10,7 @@ import {EmailService} from "../../openaireLibrary/utils/email/email.service";
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {Email} from "../../openaireLibrary/utils/email/email";
import {Composer} from "../../openaireLibrary/utils/email/composer";
declare var UIkit: any;
@ -113,7 +114,7 @@ export class SubscribeComponent {
} else {
if(!this.subscribed){
this.subscribed = true;
this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/notifyForNewSubscribers/" + this.communityId, this.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers)).subscribe(
this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/notifyForNewSubscribers/" + this.communityId, Composer.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers)).subscribe(
res => {
console.log("The email has been sent successfully!")
},
@ -125,28 +126,28 @@ export class SubscribeComponent {
}
}
// TODO find the right place to write it
composeEmailToInformManagers(communityName: string, communityId: string, managers: any): Email {
this.emailToInformManagers.subject = "[OpenAIRE-Connect] " + communityName + ": New subscriber notification";
this.emailToInformManagers.body = "<div style='font-size:14px;'>"
+"<p>There is a new subscriber for \"" + communityName + "\" community. Click "
+ "<a href='https://beta.admin.connect.openaire.eu/manage-subscribers?communityId="
+ communityId + "'>here</a> to manage the subscibers list. </p>"
+ "<p>OpenAIRE team<br> <a href='https://www.openaire.eu/'>www.openaire.eu</a></p><br>"
+ "<p style='font-size:11px;'>You are receiving this e-mail as manager of the community "
+ "<a href='https://beta." + communityId + ".openaire.eu/'>" + communityName + "</a>. "
+ "If you are not responsible for this community, please "
+ "<a href='mailto:openaire.test@gmail.com'>contact us</a>."
+ "<br>"
+ "Click <a href='https://beta.admin.connect.openaire.eu/manage-user-notifications?communityId=" + communityId
+ "'>here</a> to manage your notification settings. </p>"
+ "</div>";
this.emailToInformManagers.recipients = managers;
console.log(this.emailToInformManagers);
return this.emailToInformManagers;
}
// // TODO find the right place to write it
// composeEmailToInformManagers(communityName: string, communityId: string, managers: any): Email {
// this.emailToInformManagers.subject = "[OpenAIRE-Connect] " + communityName + ": New subscriber notification";
// this.emailToInformManagers.body = "<div style='font-size:14px;'>"
// +"<p>There is a new subscriber for \"" + communityName + "\" community. Click "
// + "<a href='https://beta.admin.connect.openaire.eu/manage-subscribers?communityId="
// + communityId + "'>here</a> to manage the subscibers list. </p>"
// + "<p>OpenAIRE team<br> <a href='https://www.openaire.eu/'>www.openaire.eu</a></p><br>"
// + "<p style='font-size:11px;'>You are receiving this e-mail as manager of the community "
// + "<a href='https://beta." + communityId + ".openaire.eu/'>" + communityName + "</a>. "
// + "If you are not responsible for this community, please "
// + "<a href='mailto:openaire.test@gmail.com'>contact us</a>."
// + "<br>"
// + "Click <a href='https://beta.admin.connect.openaire.eu/manage-user-notifications?communityId=" + communityId
// + "'>here</a> to manage your notification settings. </p>"
// + "</div>";
//
// this.emailToInformManagers.recipients = managers;
// console.log(this.emailToInformManagers);
//
// return this.emailToInformManagers;
// }
unsubscribe(){
var email = Session.getUserEmail();