Skip to content

Commit 6972a38

Browse files
authored
Merge pull request DSpace#1868 from tdonohue/fix_1867
Fixes Community "Assign Roles" page
2 parents c7029ed + 0235cc2 commit 6972a38

3 files changed

Lines changed: 24 additions & 20 deletions

File tree

src/app/community-page/edit-community-page/community-roles/community-roles.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<ds-comcol-role
2-
*ngFor="let comcolRole of getComcolRoles$() | async"
2+
*ngFor="let comcolRole of comcolRoles$ | async"
33
[dso]="community$ | async"
44
[comcolRole]="comcolRole"
55
>

src/app/community-page/edit-community-page/community-roles/community-roles.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ describe('CommunityRolesComponent', () => {
7878
fixture.detectChanges();
7979
});
8080

81-
it('should display a community admin role component', () => {
81+
it('should display a community admin role component', (done) => {
8282
expect(de.query(By.css('ds-comcol-role .community-admin')))
8383
.toBeTruthy();
84+
done();
8485
});
8586
});

src/app/community-page/edit-community-page/community-roles/community-roles.component.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,14 @@ export class CommunityRolesComponent implements OnInit {
1919
dsoRD$: Observable<RemoteData<Community>>;
2020

2121
/**
22-
* The community to manage, as an observable.
22+
* The different roles for the community, as an observable.
2323
*/
24-
get community$(): Observable<Community> {
25-
return this.dsoRD$.pipe(
26-
getFirstSucceededRemoteData(),
27-
getRemoteDataPayload(),
28-
);
29-
}
24+
comcolRoles$: Observable<HALLink[]>;
3025

3126
/**
32-
* The different roles for the community.
27+
* The community to manage, as an observable.
3328
*/
34-
getComcolRoles$(): Observable<HALLink[]> {
35-
return this.community$.pipe(
36-
map((community) => [
37-
{
38-
name: 'community-admin',
39-
href: community._links.adminGroup.href,
40-
},
41-
]),
42-
);
43-
}
29+
community$: Observable<Community>;
4430

4531
constructor(
4632
protected route: ActivatedRoute,
@@ -52,5 +38,22 @@ export class CommunityRolesComponent implements OnInit {
5238
first(),
5339
map((data) => data.dso),
5440
);
41+
42+
this.community$ = this.dsoRD$.pipe(
43+
getFirstSucceededRemoteData(),
44+
getRemoteDataPayload(),
45+
);
46+
47+
/**
48+
* The different roles for the community.
49+
*/
50+
this.comcolRoles$ = this.community$.pipe(
51+
map((community) => [
52+
{
53+
name: 'community-admin',
54+
href: community._links.adminGroup.href,
55+
},
56+
]),
57+
);
5558
}
5659
}

0 commit comments

Comments
 (0)