Use Composer

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@54343 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-12-12 13:08:02 +00:00
parent 70acf2df7d
commit 54314fdaaf
1 changed files with 28 additions and 5 deletions

View File

@ -12,6 +12,7 @@ import {EnvProperties} from '../../../openaire
import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo'; import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo';
import {Email} from "../../../openaireLibrary/utils/email/email"; import {Email} from "../../../openaireLibrary/utils/email/email";
import {Composer} from "../../../openaireLibrary/utils/email/composer";
import {Session} from '../../../openaireLibrary/login/utils/helper.class'; import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class'; import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
@ -233,21 +234,43 @@ export class CommunityEditFormComponent implements OnInit{
} }
private sendMailToNewManagers(managers: any) { 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 => { res => {
console.log("The email has been sent successfully!") console.log("The email has been sent successfully!")
}, },
error => console.log(error) 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) { 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 => { res => {
console.log("The email has been sent successfully!") console.log("The email has been sent successfully!")
}, },
error => console.log(error) 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 { private composeEmailForNewManager(communityName: string, newCommunityManagers: any): Email {