Merge pull request #5739 from tsiegleauq/hide-started-assignment-polls

Hide started assignment polls
This commit is contained in:
Sean 2020-12-03 12:19:38 +01:00 committed by GitHub
commit 944685696a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -1,4 +1,4 @@
<mat-card class="os-card" *ngIf="poll">
<mat-card class="os-card" *ngIf="showPoll">
<div class="assignment-poll-wrapper">
<div>
<!-- Title -->

View File

@ -6,6 +6,7 @@ import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { OperatorService } from 'app/core/core-services/operator.service';
import { AssignmentPollRepositoryService } from 'app/core/repositories/assignments/assignment-poll-repository.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { VotingPrivacyWarningComponent } from 'app/shared/components/voting-privacy-warning/voting-privacy-warning.component';
@ -53,6 +54,19 @@ export class AssignmentPollComponent
return this.descriptionForm.get('description').value !== this.poll.description;
}
public get showPoll(): boolean {
if (this.poll) {
if (
this.operator.hasPerms(this.permission.assignmentsCanManage) ||
this.poll.isPublished ||
(this.poll.isEVoting && !this.poll.isCreated)
) {
return true;
}
}
return false;
}
public constructor(
titleService: Title,
matSnackBar: MatSnackBar,
@ -63,7 +77,8 @@ export class AssignmentPollComponent
pollDialog: AssignmentPollDialogService,
private pollService: AssignmentPollService,
private formBuilder: FormBuilder,
private pdfService: AssignmentPollPdfService
private pdfService: AssignmentPollPdfService,
private operator: OperatorService
) {
super(titleService, matSnackBar, translate, dialog, promptService, repo, pollDialog);
}