diff --git a/src/app/components/shared/comment-list/comment-list.component.html b/src/app/components/shared/comment-list/comment-list.component.html index 8e35e567bc7181da44d04e1eb1c9cdefa256d2d2..6e21ee996944be6ec1a55fdc0d55685d3d23d71a 100644 --- a/src/app/components/shared/comment-list/comment-list.component.html +++ b/src/app/components/shared/comment-list/comment-list.component.html @@ -233,7 +233,7 @@ <mat-icon>arrow_upward</mat-icon> </button> -<button *ngIf="!room.closed" +<button *ngIf="commentsEnabled" mat-fab mat-icon-button aria-labelledby="add" @@ -250,6 +250,7 @@ [userRole]="userRole" [moderator]="false" [user]="user" + [disabled]="!commentsEnabled" (clickedOnTag)="clickedOnTag($event)" (clickedUserNumber)="clickedUserNumber($event)"> </app-comment> diff --git a/src/app/components/shared/comment-list/comment-list.component.ts b/src/app/components/shared/comment-list/comment-list.component.ts index 5bc9ba945dfee91d590f4dc957f4ee202bd0df40..a29318bef4c076324958d2b43a87628e62f82a46 100644 --- a/src/app/components/shared/comment-list/comment-list.component.ts +++ b/src/app/components/shared/comment-list/comment-list.component.ts @@ -98,6 +98,7 @@ export class CommentListComponent implements OnInit, OnDestroy { period: Period = Period.TWOWEEKS; fromNow: number; moderatorIds: string[]; + commentsEnabled: boolean; constructor( private commentService: CommentService, @@ -217,6 +218,7 @@ export class CommentListComponent implements OnInit, OnDestroy { this.roomId = room.id; this.moderationEnabled = this.room.moderated; this.directSend = this.room.directSend; + this.commentsEnabled = (this.userRole > 0) || !this.room.closed; localStorage.setItem('moderationEnabled', JSON.stringify(this.moderationEnabled)); if (!this.authenticationService.hasAccess(this.shortId, UserRole.PARTICIPANT)) { this.roomService.addToHistory(this.room.id); diff --git a/src/app/components/shared/comment/comment.component.html b/src/app/components/shared/comment/comment.component.html index b8754a744934f8b45d5156a4ec72897b2381b7bb..5a8db695dfc9a7925557d987540920b6fc820105 100644 --- a/src/app/components/shared/comment/comment.component.html +++ b/src/app/components/shared/comment/comment.component.html @@ -256,7 +256,7 @@ <div fxLayout="column" fxLayoutAlign="center" - *ngIf="isStudent" + *ngIf="isStudent && !disabled" [ngClass]="{ '1': 'voteUp', '-1': 'voteDown', '0': 'reset'}[currentVote]"> <button mat-icon-button (click)="voteUp(comment)" diff --git a/src/app/components/shared/comment/comment.component.ts b/src/app/components/shared/comment/comment.component.ts index 0addf874516c8ce738583176e06c1b8ff225bd77..6943f71cf754333dfac1d13ff49efc176e50fe98 100644 --- a/src/app/components/shared/comment/comment.component.ts +++ b/src/app/components/shared/comment/comment.component.ts @@ -40,6 +40,7 @@ export class CommentComponent implements OnInit, AfterViewInit { @Input() moderator: boolean; @Input() userRole: UserRole; @Input() user: User; + @Input() disabled = false; @Output() clickedOnTag = new EventEmitter<string>(); @Output() clickedUserNumber = new EventEmitter<number>(); isStudent = false; diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html index e5db31b2f9f2fcc42089f0496db54507361804df..87c2afc38e5b7475ac8cdf867dc63c2fa0229337 100644 --- a/src/app/components/shared/header/header.component.html +++ b/src/app/components/shared/header/header.component.html @@ -107,7 +107,7 @@ <ng-container *ngIf="router.url.endsWith('/comments')"> <button mat-menu-item - *ngIf="(user.role == 0 && !room.closed) && user && !router.url.endsWith('moderator/comments')" + *ngIf="user && !router.url.endsWith('moderator/comments') && ((user.role > 0) || ((user.role == 0) && !room.closed))" tabindex="0" (click)="navigateCreateQuestion();"> <mat-icon> @@ -335,7 +335,7 @@ <ng-container *ngIf="shortId && user && user.role > 0"> <button mat-menu-item (click)="blockQuestions()" - [ngClass]="{'selected': room.closed}" + [ngClass]="{'color-warn': room.closed}" tabindex="0"> <mat-icon class="color-warn">block</mat-icon> <span>{{'header.block' | translate}}</span> diff --git a/src/app/components/shared/header/header.component.scss b/src/app/components/shared/header/header.component.scss index 5ac559524aeec0a0b7d634e703b12e403966e21a..2cbe46f2d37731df916225704471332a85e17dec 100644 --- a/src/app/components/shared/header/header.component.scss +++ b/src/app/components/shared/header/header.component.scss @@ -97,7 +97,3 @@ svg { background-color: transparent !important; } } - -.selected { - color: red !important; -} \ No newline at end of file diff --git a/src/app/components/shared/header/header.component.ts b/src/app/components/shared/header/header.component.ts index 17164a2c16d7b885fea70824f660acd8da193c1a..14704da8f0da646fd831a19d60dcec2c7daf5926 100644 --- a/src/app/components/shared/header/header.component.ts +++ b/src/app/components/shared/header/header.component.ts @@ -113,6 +113,9 @@ export class HeaderComponent implements OnInit { this.shortId = segments[2].path; localStorage.setItem('shortId', this.shortId); this.roomService.getRoomByShortId(this.shortId).subscribe(room => this.room = room); + } else { + this.shortId = ''; + this.room = null; } } } @@ -307,6 +310,7 @@ export class HeaderComponent implements OnInit { public blockQuestions() { // flip state if clicked this.room.closed = !this.room.closed; + this.roomService.updateRoom(this.room).subscribe(r => this.room = r); } } diff --git a/src/app/components/shared/room-list/room-list.component.html b/src/app/components/shared/room-list/room-list.component.html index ba91b8547d2f22346f88c798f45b5d45bf214be0..b7e63704a82237938ae88acfc2cb9bb36301f274 100644 --- a/src/app/components/shared/room-list/room-list.component.html +++ b/src/app/components/shared/room-list/room-list.component.html @@ -33,6 +33,7 @@ <td mat-cell class="clickable" *matCellDef="let room" (click)="setCurrentRoom(room.shortId)" routerLink="/{{ roleToString((room.role)) }}/room/{{ room.shortId }}"> <span matBadge="{{room.commentCount > 0 ? room.commentCount : null}}" matBadgePosition="before" matBadgeSize="small" matBadgeOverlap="false"> + <mat-icon *ngIf="room.closed" class="warn" [inline]="true">block</mat-icon> »{{room.name}}« </span> </td> diff --git a/src/app/components/shared/room-list/room-list.component.scss b/src/app/components/shared/room-list/room-list.component.scss index cd8996e28f42f64346f2feaac8dbe21e04ab21ef..d78a6a10eb119060e08f895713f7b4c1541edb40 100644 --- a/src/app/components/shared/room-list/room-list.component.scss +++ b/src/app/components/shared/room-list/room-list.component.scss @@ -100,3 +100,7 @@ th, tr { .list-entries { width: 100%; } + +.warn { + color: var(--red) !important; +} \ No newline at end of file