Enable membership and add condition in users->members

This commit is contained in:
Konstantinos Triantafyllou 2023-10-10 12:30:47 +03:00
parent 2f9b12c478
commit 8e27e29605
6 changed files with 31 additions and 13 deletions

@ -1 +1 @@
Subproject commit 5e4aaab04f89446f956d524469ef2a856f556de5 Subproject commit c12916583247fc225ee49c4851b8b4183edc2be0

View File

@ -77,22 +77,21 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach
<!-- Full width error message --> <!-- Full width error message -->
<div *ngIf="uploadError" class="uk-text-danger uk-margin-small-top uk-width-1-1">{{uploadError}}</div> <div *ngIf="uploadError" class="uk-text-danger uk-margin-small-top uk-width-1-1">{{uploadError}}</div>
</div> </div>
<div class="uk-width-1-2@m"> <div class="uk-width-1-3@m">
<div input [formInput]="communityFb.get('status')" <div input [formInput]="communityFb.get('status')"
placeholder="Visibility status for your community's profile." placeholder="Visibility status for your community's profile."
[options]="statuses" type="select"></div> [options]="statuses" type="select"></div>
</div> </div>
<div class="uk-width-1-2@m"> <div class="uk-width-1-3@m">
<div input [formInput]="communityFb.get('claim')" <div input [formInput]="communityFb.get('claim')"
placeholder="Who can create links for your community" placeholder="Who can create links for your community"
[options]="claimOptions" type="select"></div> [options]="claimOptions" type="select"></div>
</div> </div>
<!-- Hide until the functionality is ready--> <div class="uk-width-1-3@m">
<!-- <div class="uk-width-1-2@m">
<div input [formInput]="communityFb.get('membership')" <div input [formInput]="communityFb.get('membership')"
placeholder="Who can join" placeholder="Who can join"
[options]="membershipOptions" type="select"></div> [options]="membershipOptions" type="select"></div>
</div>--> </div>
</div> </div>
</form> </form>
`, `,

View File

@ -25,12 +25,11 @@ export class UsersManagersComponent implements OnInit {
public message: string; public message: string;
public inviteDisableMessage: string; public inviteDisableMessage: string;
public emailComposer: Function = (name, recipient, role):Email => { public emailComposer: Function = (name, recipient, role):Email => {
return Composer.composeEmailForCommunityDashboard(name, recipient); return Composer.composeEmailForCommunityDashboard(name, role, recipient);
} }
private subscriptions: any[] = []; private subscriptions: any[] = [];
constructor(private communityService: CommunityService, constructor(private communityService: CommunityService,
private route: ActivatedRoute,
private title: Title) { private title: Title) {
} }

View File

@ -4,24 +4,36 @@ import {ActivatedRoute} from "@angular/router";
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service"; import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
import {Subscriber} from "rxjs"; import {Subscriber} from "rxjs";
import {CommunityInfo} from "../../../openaireLibrary/connect/community/communityInfo"; import {CommunityInfo} from "../../../openaireLibrary/connect/community/communityInfo";
import {Email} from "../../../openaireLibrary/utils/email/email";
import {Composer} from "../../../openaireLibrary/utils/email/composer";
import {properties} from "../../../../environments/environment";
@Component({ @Component({
selector: 'users-subscribers', selector: 'users-subscribers',
template: ` template: `
<subscribers [id]="community.communityId" [type]="'community'" [name]="community.shortTitle" <subscribers *ngIf="community.isOpen()" [id]="community.communityId" [type]="'community'" [name]="community.shortTitle"
[inviteDisableMessage]="inviteDisableMessage"> [inviteDisableMessage]="inviteDisableMessage">
<users-tabs tab="member"></users-tabs> <users-tabs tab="member"></users-tabs>
</subscribers> </subscribers>
<role-users *ngIf="!community.isOpen()" [id]="community.communityId" [type]="community.type" [name]="community.shortTitle" [inviteDisableMessage]="inviteDisableMessage"
[link]="link" [role]="'member'"
[message]="message" [emailComposer]="emailComposer">
<users-tabs tab="member"></users-tabs>
</role-users>
` `
}) })
export class UsersSubscribersComponent implements OnInit { export class UsersSubscribersComponent implements OnInit {
public community: CommunityInfo; public community: CommunityInfo;
public link: string;
public loading: boolean; public loading: boolean;
public message: string;
public inviteDisableMessage: string; public inviteDisableMessage: string;
public emailComposer: Function = (name, recipient, role):Email => {
return Composer.composeEmailForCommunityDashboard(name, role, recipient);
}
private subscriptions: any[] = []; private subscriptions: any[] = [];
constructor(private communityService: CommunityService, constructor(private communityService: CommunityService,
private route: ActivatedRoute,
private title: Title) { private title: Title) {
} }
@ -30,7 +42,10 @@ export class UsersSubscribersComponent implements OnInit {
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => { this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
if(community) { if(community) {
this.community = community; this.community = community;
this.title.setTitle(this.community.shortTitle.toUpperCase() + " | Subscribers"); this.title.setTitle(this.community.shortTitle.toUpperCase() + " | Members");
this.link = this.getURL(this.community.communityId);
this.message = 'A member can access the community dashboard and link research results with projects, ' +
'communities and other research projects.';
if(community.status !== "all") { if(community.status !== "all") {
this.inviteDisableMessage = "Community's status is " + (community.status === 'manager'?'Visible to managers':'Hidden') + " and invitation to join the Research community dashboard is disabled. Update the community status to enable invitations." this.inviteDisableMessage = "Community's status is " + (community.status === 'manager'?'Visible to managers':'Hidden') + " and invitation to join the Research community dashboard is disabled. Update the community status to enable invitations."
} }
@ -46,4 +61,8 @@ export class UsersSubscribersComponent implements OnInit {
} }
}); });
} }
private getURL(id: string): string {
return 'https://' + (properties.environment !== "production"?'beta.':'') + id + ".openaire.eu?verify=";
}
} }

View File

@ -5,11 +5,12 @@ import {LoadingModule} from "../../../openaireLibrary/utils/loading/loading.modu
import {RouterModule} from "@angular/router"; import {RouterModule} from "@angular/router";
import {SubscribersModule} from "../../../openaireLibrary/dashboard/users/subscribers/subscribers.module"; import {SubscribersModule} from "../../../openaireLibrary/dashboard/users/subscribers/subscribers.module";
import {UsersTabsModule} from '../users-tabs.module'; import {UsersTabsModule} from '../users-tabs.module';
import {RoleUsersModule} from "../../../openaireLibrary/dashboard/users/role-users/role-users.module";
@NgModule({ @NgModule({
imports: [CommonModule, LoadingModule, RouterModule.forChild([ imports: [CommonModule, LoadingModule, RouterModule.forChild([
{path: '', component: UsersSubscribersComponent} {path: '', component: UsersSubscribersComponent}
]), SubscribersModule, UsersTabsModule], ]), SubscribersModule, UsersTabsModule, RoleUsersModule],
declarations: [UsersSubscribersComponent], declarations: [UsersSubscribersComponent],
exports: [UsersSubscribersComponent] exports: [UsersSubscribersComponent]
}) })

@ -1 +1 @@
Subproject commit ac458b5a6d156167d7b6c9005ef1f9cfac75d3ae Subproject commit 2df4b377a3e89b7dd26a011a2e1e1f07fdcedf2a