From 8acc64fc10cc4fb79040038775cc62bc1bcec2ec Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 2 Mar 2021 10:08:19 +0000 Subject: [PATCH] [Library | Trunk]: 1. Role users disable remove button for members when a user is a manager. 2. Change email message for community managers invitation git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60545 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../role-users/role-users.component.html | 5 +++-- .../users/role-users/role-users.component.ts | 19 ++++++++++++++++--- .../subscribers/subscribers.component.html | 5 +++-- utils/email/composer.ts | 14 ++++++-------- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/dashboard/users/role-users/role-users.component.html b/dashboard/users/role-users/role-users.component.html index 8be67a52..8eeebc39 100644 --- a/dashboard/users/role-users/role-users.component.html +++ b/dashboard/users/role-users/role-users.component.html @@ -53,10 +53,11 @@
diff --git a/dashboard/users/role-users/role-users.component.ts b/dashboard/users/role-users/role-users.component.ts index be23e8c9..bfe66e12 100644 --- a/dashboard/users/role-users/role-users.component.ts +++ b/dashboard/users/role-users/role-users.component.ts @@ -36,6 +36,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges { public notificationFn: Function; public user: User = null; public active: any[]; + public managers: any[]; public pending: any[]; public showActive: boolean = true; public subs: any[] = []; @@ -88,9 +89,21 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges { this.loadActive = true; this.loadPending = true; this.subs.push(this.userRegistryService.getActiveEmail(this.type, this.id, this.role).subscribe(users => { - this.active = users; - this.loadActive = false; - this.exists = true; + if(this.role === 'member') { + this.subs.push(this.userRegistryService.getActiveEmail(this.type, this.id, 'manager').subscribe(managers => { + this.managers = managers; + this.active = users; + this.active.forEach(user => { + user['isManager'] = this.managers.find(manager => manager.email === user.email); + }); + this.loadActive = false; + this.exists = true; + })) + } else { + this.active = users; + this.loadActive = false; + this.exists = true; + } }, error => { this.active = []; if(error.status === 404) { diff --git a/dashboard/users/subscribers/subscribers.component.html b/dashboard/users/subscribers/subscribers.component.html index 2c3010dc..260ad568 100644 --- a/dashboard/users/subscribers/subscribers.component.html +++ b/dashboard/users/subscribers/subscribers.component.html @@ -51,10 +51,11 @@
diff --git a/utils/email/composer.ts b/utils/email/composer.ts index de9feb2c..0f2c7c6b 100644 --- a/utils/email/composer.ts +++ b/utils/email/composer.ts @@ -248,23 +248,21 @@ export class Composer { return message; } - public static composeEmailForCommunityDashboard(name: string, recipient: string, role: "manager" | "member") { + public static composeEmailForCommunityDashboard(name: string, recipient: string) { let email: Email = new Email(); email.subject = 'OpenAIRE Monitor Dashboard | ' + name; - email.body = this.composeMessageForCommunityDashboard(name, role); + email.body = this.composeMessageForCommunityDashboard(name); email.recipient = recipient; return email; } - public static composeMessageForCommunityDashboard(name: string, role: "manager" | "member", user: string = null, invitation: any = null) { + public static composeMessageForCommunityDashboard(name: string, user: string = null, invitation: any = null) { let message = '

Dear ((__user__)),

' + - '

You have been invited to be a ' + role +' of the OpenAIRE Monitor Dashboard for the ' + name + '.

' + + '

You have been invited to be a manager of the OpenAIRE Research Community Dashboard for the ' + name + '.

' + '

Click this URL and use the verification code below to accept the invitation.

' + '

The verification code is ((__code__)).

' + - (role === "manager"? - '

As a manager of the OpenAIRE Monitor Dashboard, you will have access to the administration part of the dashboard, ' + - 'where you will be able to customize and manage the profile of the ' + name + '.

': - '

As a member of the OpenAIRE Monitor Dashboard, you will have access to the restricted access areas of the profile for the ' + name + '.') + + '

As a manager of the OpenAIRE Research Community Dashboard, you will have access to the administration part of the dashboard, ' + + 'where you will be able to customize and manage the content of the ' + name + '.

' + '

Please contact us at ' + properties.helpdeskEmail + ' if you have any questions or concerns.

' + '

Kind Regards
The OpenAIRE Team

' +