diff --git a/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll/assignment-poll.component.html b/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll/assignment-poll.component.html index 3d23b5ce2..dbcbc2446 100644 --- a/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll/assignment-poll.component.html +++ b/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll/assignment-poll.component.html @@ -76,9 +76,7 @@ -
- -
+ diff --git a/client/src/app/site/cinema/components/poll-collection/poll-collection.component.html b/client/src/app/site/cinema/components/poll-collection/poll-collection.component.html index bff6ce6c9..8af22c666 100644 --- a/client/src/app/site/cinema/components/poll-collection/poll-collection.component.html +++ b/client/src/app/site/cinema/components/poll-collection/poll-collection.component.html @@ -16,7 +16,7 @@ {{ getPollVoteTitle(poll) }}

- +
diff --git a/client/src/app/site/cinema/components/poll-collection/poll-collection.component.ts b/client/src/app/site/cinema/components/poll-collection/poll-collection.component.ts index b0ebb00fb..0b6a866da 100644 --- a/client/src/app/site/cinema/components/poll-collection/poll-collection.component.ts +++ b/client/src/app/site/cinema/components/poll-collection/poll-collection.component.ts @@ -143,13 +143,4 @@ export class PollCollectionComponent extends BaseViewComponentDirective implemen } return null; } - - public canManage(poll: ViewBasePoll): boolean { - if (poll.pollClassType === PollClassType.Motion) { - return this.operator.hasPerms(this.permission.motionsCanManagePolls); - } else if (poll.pollClassType === PollClassType.Assignment) { - return this.operator.hasPerms(this.permission.assignmentsCanManage); - } - return false; - } } diff --git a/client/src/app/site/motions/modules/motion-poll/motion-poll/motion-poll.component.html b/client/src/app/site/motions/modules/motion-poll/motion-poll/motion-poll.component.html index c3261817f..1abcae488 100644 --- a/client/src/app/site/motions/modules/motion-poll/motion-poll/motion-poll.component.html +++ b/client/src/app/site/motions/modules/motion-poll/motion-poll/motion-poll.component.html @@ -67,9 +67,7 @@ -
- -
+
diff --git a/client/src/app/site/polls/components/poll-progress/poll-progress.component.ts b/client/src/app/site/polls/components/poll-progress/poll-progress.component.ts index 7a1742aa7..2df1678ba 100644 --- a/client/src/app/site/polls/components/poll-progress/poll-progress.component.ts +++ b/client/src/app/site/polls/components/poll-progress/poll-progress.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; @@ -13,7 +13,8 @@ import { PollClassType, ViewBasePoll } from 'app/site/polls/models/view-base-pol @Component({ selector: 'os-poll-progress', templateUrl: './poll-progress.component.html', - styleUrls: ['./poll-progress.component.scss'] + styleUrls: ['./poll-progress.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush }) export class PollProgressComponent extends BaseViewComponentDirective implements OnInit { @Input() @@ -24,14 +25,28 @@ export class PollProgressComponent extends BaseViewComponentDirective implements return this.poll?.votescast || 0; } - public get canSeeProgressBar(): boolean { - let canManage = false; - if (this.poll?.pollClassType === PollClassType.Motion) { - canManage = this.operator.hasPerms(this.permission.motionsCanManagePolls); - } else if (this.poll?.pollClassType === PollClassType.Assignment) { - canManage = this.operator.hasPerms(this.permission.assignmentsCanManage); + private get canSeeNames(): boolean { + return this.operator.hasPerms(this.permission.usersCanSeeName); + } + + private get canManageSpeakers(): boolean { + return this.operator.hasPerms(this.permission.agendaCanManageListOfSpeakers); + } + + private get canManagePoll(): boolean { + if (this.poll.pollClassType === PollClassType.Motion) { + return this.operator.hasPerms(this.permission.motionsCanManagePolls); + } else if (this.poll.pollClassType === PollClassType.Assignment) { + return this.operator.hasPerms(this.permission.assignmentsCanManage); } - return canManage && this.operator.hasPerms(this.permission.usersCanSeeName); + return false; + } + + public get canSeeProgressBar(): boolean { + if (!this.canSeeNames) { + return false; + } + return this.canManageSpeakers || this.canManagePoll; } public constructor( @@ -39,7 +54,8 @@ export class PollProgressComponent extends BaseViewComponentDirective implements protected translate: TranslateService, snackbar: MatSnackBar, private userRepo: UserRepositoryService, - private operator: OperatorService + private operator: OperatorService, + private cd: ChangeDetectorRef ) { super(title, translate, snackbar); } @@ -67,7 +83,11 @@ export class PollProgressComponent extends BaseViewComponentDirective implements ) .subscribe(users => { this.max = users.length; - }) + this.cd.markForCheck(); + }), + this.operator.getUserObservable().subscribe(() => { + this.cd.markForCheck(); + }) ); } }