diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 6b23d40b29f2aedf1da21b896d8135c0212e3c1b..64355dff4f8613dbb68333effaa93da48e3221d3 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -44,7 +44,7 @@ const routes: Routes = [ canActivate: [AuthenticationGuard], data: { roles: [UserRole.CREATOR] } }, - { path: 'room/:roomId/create-comment', + { path: 'participant/room/:roomId/create-comment', component: CreateCommentComponent, canActivate: [AuthenticationGuard], data: { roles: [UserRole.PARTICIPANT] } diff --git a/src/app/create-comment/create-comment.component.ts b/src/app/create-comment/create-comment.component.ts index b3d5c1afb4a224f3a18ad784f81ffc3aceedfb3f..fae17afe2c4a01b242f53cfe13b1d9be1069c758 100644 --- a/src/app/create-comment/create-comment.component.ts +++ b/src/app/create-comment/create-comment.component.ts @@ -46,7 +46,7 @@ export class CreateCommentComponent implements OnInit { body: body, creationTimestamp: new Date(Date.now()) } as Comment).subscribe(room => { - this.router.navigate([`room/${this.room.id}`]); + this.router.navigate([`/participant/room/${this.room.id}`]); this.notification.show(`Comment '${subject}' successfully created.`); }); } diff --git a/src/app/participant-room/participant-room.component.html b/src/app/participant-room/participant-room.component.html index 250352b278958dc693284df5094455d51b06cc88..2b331ee833eba5995314396b4b5c2643e49dbc16 100644 --- a/src/app/participant-room/participant-room.component.html +++ b/src/app/participant-room/participant-room.component.html @@ -14,10 +14,10 @@ </mat-card-content> <mat-divider></mat-divider> <mat-card-actions> - <button mat-icon-button color="primary" matTooltip="Ask something" routerLink="room/{{room.id}}/create-comment"> + <button mat-icon-button color="primary" matTooltip="Ask something"> <mat-icon>question_answer</mat-icon> </button> - <button mat-icon-button color="primary" matTooltip="Give feedback"> + <button mat-icon-button color="primary" matTooltip="Give feedback" routerLink="/participant/room/{{roomId}}/create-comment"> <mat-icon>feedback</mat-icon> </button> <button mat-button color="primary" matTooltip="Join question round"> diff --git a/src/app/room-list/room-list.component.html b/src/app/room-list/room-list.component.html index abc862f2d89b478caa0511f8ff912a8911215afe..064298368a1775853e3f2f57ae3617c60b41091f 100644 --- a/src/app/room-list/room-list.component.html +++ b/src/app/room-list/room-list.component.html @@ -12,7 +12,7 @@ {{ room.description }} </p> <mat-action-row> - <button mat-button routerLink="room/{{ room.id }}">Join room</button> + <button mat-button routerLink="/{{ role }}/room/{{ room.id }}">Join room</button> </mat-action-row> </mat-expansion-panel> </mat-accordion> diff --git a/src/app/room-list/room-list.component.ts b/src/app/room-list/room-list.component.ts index effcbed6ce821c6a5dd162c6e705ef40be0241f4..823ed00cd4e684d883d66516999cf04f57f63f84 100644 --- a/src/app/room-list/room-list.component.ts +++ b/src/app/room-list/room-list.component.ts @@ -1,6 +1,8 @@ import { Component, OnInit } from '@angular/core'; import { Room } from '../room'; import { RoomService } from '../room.service'; +import { AuthenticationService} from '../authentication.service'; +import {UserRole} from '../user-roles.enum'; @Component({ selector: 'app-room-list', @@ -10,12 +12,23 @@ import { RoomService } from '../room.service'; export class RoomListComponent implements OnInit { rooms: Room[]; closedRooms: Room[]; + role: string; - constructor(protected roomService: RoomService) { - } + constructor( + private roomService: RoomService, + protected authenticationService: AuthenticationService) {} ngOnInit() { this.getRooms(); + this.getPath(); + } + + getPath() { + if (this.authenticationService.getRole() == UserRole.CREATOR) { + this.role = 'creator'; + } else { + this.role = 'participant'; + } } getRooms(): void {