diff --git a/src/app/components/shared/comment/comment.component.html b/src/app/components/shared/comment/comment.component.html index dfd9385982dbb9080d205848db1b6ad86c681928..b7c0668005e99741c151f4b19c092b57671ed754 100644 --- a/src/app/components/shared/comment/comment.component.html +++ b/src/app/components/shared/comment/comment.component.html @@ -2,13 +2,13 @@ <div fxLayout="row" fxLayoutAlign="center center"> <mat-card-title>{{comment.subject}}</mat-card-title> <span class="fill-remaining-space"></span> - <button mat-icon-button [disabled]="userRole === 0" (click)="setCorrect(comment)" [matTooltip]="comment.correct ? 'Antwort richtig' : null"> + <button mat-icon-button [disabled]="isCreator" (click)="setCorrect(comment)" [matTooltip]="comment.correct ? 'Antwort richtig' : null"> <mat-icon [ngClass]="{'correct-icon' : comment.correct === true}">check_circle</mat-icon> </button> - <button mat-icon-button [disabled]="userRole === 0" (click)="setFavorite(comment)" [matTooltip]="comment.favorite ? 'mark as favorite' : 'mark as not favorite'"> + <button mat-icon-button [disabled]="isCreator" (click)="setFavorite(comment)" [matTooltip]="comment.favorite ? 'mark as favorite' : 'mark as not favorite'"> <mat-icon [ngClass]="{'favorite-icon' : comment.favorite === true}">star</mat-icon> </button> - <button mat-icon-button [disabled]="userRole === 0" (click)="setRead(comment)" [matTooltip]="comment.read ? 'mark me as unread' : 'mark me as read'"> + <button mat-icon-button [disabled]="isCreator" (click)="setRead(comment)" [matTooltip]="comment.read ? 'mark me as unread' : 'mark me as read'"> <mat-icon [ngClass]="{'read-icon' : comment.read === true}">visibility</mat-icon> </button> </div> diff --git a/src/app/components/shared/comment/comment.component.ts b/src/app/components/shared/comment/comment.component.ts index 1178377c1dab0fb92f1cc29d8e4a194c09ec7159..0a7b94d7b03ccd714d9ece9b3213bd20b238fbf9 100644 --- a/src/app/components/shared/comment/comment.component.ts +++ b/src/app/components/shared/comment/comment.component.ts @@ -1,6 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; import { Comment } from '../../../models/comment'; -import { UserRole } from '../../../models/user-roles.enum'; import { AuthenticationService } from '../../../services/http/authentication.service'; import { ActivatedRoute } from '@angular/router'; import { Location } from '@angular/common'; @@ -16,7 +15,7 @@ import { LanguageService } from '../../../services/util/language.service'; }) export class CommentComponent implements OnInit { @Input() comment: Comment; - userRole: UserRole; + isCreator = false; isLoading = true; constructor(protected authenticationService: AuthenticationService, @@ -29,7 +28,9 @@ export class CommentComponent implements OnInit { langService.langEmitter.subscribe(lang => translateService.use(lang)); } ngOnInit() { - this.userRole = this.authenticationService.getRole(); + if (this.authenticationService.getRole() === 0) { + this.isCreator = true; + } this.translateService.use(localStorage.getItem('currentLang')); }