From 54314fdaaf7e5c449b3c4f9f2ae28480e534cb0b Mon Sep 17 00:00:00 2001 From: "sofia.baltzi" Date: Wed, 12 Dec 2018 13:08:02 +0000 Subject: [PATCH] Use Composer git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@54343 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../community-edit-form.component.ts | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/app/pages/community/community-edit-form/community-edit-form.component.ts b/src/app/pages/community/community-edit-form/community-edit-form.component.ts index de3cfc1..2641671 100644 --- a/src/app/pages/community/community-edit-form/community-edit-form.component.ts +++ b/src/app/pages/community/community-edit-form/community-edit-form.component.ts @@ -12,6 +12,7 @@ import {EnvProperties} from '../../../openaire import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo'; import {Email} from "../../../openaireLibrary/utils/email/email"; +import {Composer} from "../../../openaireLibrary/utils/email/composer"; import {Session} from '../../../openaireLibrary/login/utils/helper.class'; import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class'; @@ -68,7 +69,7 @@ export class CommunityEditFormComponent implements OnInit{ this.route.queryParams.subscribe( communityId => { this.scroll(); - + this.communityId = communityId['communityId']; this.email = {body: "", subject: "", recipients: []}; @@ -233,21 +234,43 @@ export class CommunityEditFormComponent implements OnInit{ } private sendMailToNewManagers(managers: any) { - this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/sendMail/", this.composeEmailForNewManager(this.community.title, managers)).subscribe( + this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/sendMail/", + Composer.composeEmailForNewManager(this.communityId, this.community.title, managers)).subscribe( res => { console.log("The email has been sent successfully!") }, error => console.log(error) - ); + ); + + // this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/sendMail/", + // this.composeEmailForNewManager(this.community.title, managers)).subscribe( + // res => { + // console.log("The email has been sent successfully!") + // }, + // error => console.log(error) + // ); } private informOldManagersForTheNewOnes(managers: any) { - this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/notifyForNewManagers/" + this.communityId, this.composeEmailToInformOldManagersForTheNewOnes(this.community.title, this.communityId, this.firstVersionOfManagers)).subscribe( + this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/notifyForNewManagers/" + this.communityId, + Composer.composeEmailToInformOldManagersForTheNewOnes(this.community.title, this.communityId, + this.firstVersionOfManagers, + this.community.managers)).subscribe( res => { console.log("The email has been sent successfully!") }, error => console.log(error) - ); + ); + + // this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/notifyForNewManagers/" + this.communityId, + // this.composeEmailToInformOldManagersForTheNewOnes(this.community.title, + // this.communityId, + // this.firstVersionOfManagers)).subscribe( + // res => { + // console.log("The email has been sent successfully!") + // }, + // error => console.log(error) + // ); } private composeEmailForNewManager(communityName: string, newCommunityManagers: any): Email {