From e7343810d5612f5ce30d41536c5c9a1d77093d31 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Fri, 30 Apr 2021 23:43:44 +0200 Subject: [PATCH] fix deps to config prop --- src/app/core/models/poll.model.ts | 4 ++++ .../stepper/stepper.component.ts | 24 ++++++------------- .../add-answer/add-answer.component.html | 4 ++-- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/app/core/models/poll.model.ts b/src/app/core/models/poll.model.ts index 18032a65..2883d1fe 100644 --- a/src/app/core/models/poll.model.ts +++ b/src/app/core/models/poll.model.ts @@ -37,6 +37,10 @@ export class Poll { public has_several_hours?: boolean = false; public hasSeveralHours?: boolean = false; + public isOwnerNotifiedByEmailOnNewVote?: boolean = true; + public isOwnerNotifiedByEmailOnNewComment?: boolean = true; + public isMaybeAnswerAvailable?: boolean = true; + public areResultsPublic?: boolean = true; public allowSeveralHours?: boolean; diff --git a/src/app/features/administration/stepper/stepper.component.ts b/src/app/features/administration/stepper/stepper.component.ts index 52f781b5..4df9c485 100644 --- a/src/app/features/administration/stepper/stepper.component.ts +++ b/src/app/features/administration/stepper/stepper.component.ts @@ -30,29 +30,19 @@ export class StepperComponent implements OnInit { }); this.configurationFormGroup = this.fb.group({ - title: [this.poll ? this.poll.configuration : false, [Validators.required]], - isAboutDate: [this.poll ? this.poll.configuration.isAboutDate : false, [Validators.required]], - isProtectedByPassword: [ - this.poll ? this.poll.configuration.isProtectedByPassword : false, - [Validators.required], - ], + title: [this.poll ? this.poll : false, [Validators.required]], + isAboutDate: [this.poll ? this.poll.kind === 'date' : false, [Validators.required]], + isProtectedByPassword: [this.poll ? this.poll.password.length : false, [Validators.required]], isOwnerNotifiedByEmailOnNewVote: [ - this.poll ? this.poll.configuration.isOwnerNotifiedByEmailOnNewVote : false, + this.poll ? this.poll.isOwnerNotifiedByEmailOnNewVote : false, [Validators.required], ], isOwnerNotifiedByEmailOnNewComment: [ - this.poll ? this.poll.configuration.isOwnerNotifiedByEmailOnNewComment : false, - [Validators.required], - ], - isMaybeAnswerAvailable: [ - this.poll ? this.poll.configuration.isMaybeAnswerAvailable : false, - [Validators.required], - ], - areResultsPublic: [this.poll ? this.poll.configuration.areResultsPublic : true, [Validators.required]], - expiracyNumberOfDays: [ - this.poll ? DateService.diffInDays(new Date(), this.poll.configuration.expiracyDate) : 60, + this.poll ? this.poll.isOwnerNotifiedByEmailOnNewComment : false, [Validators.required], ], + areResultsPublic: [this.poll ? this.poll.areResultsPublic : true, [Validators.required]], + expiracyNumberOfDays: [this.poll ? this.poll.default_expiracy_days_from_now : '60', [Validators.required]], }); } diff --git a/src/app/features/participation/add-answer/add-answer.component.html b/src/app/features/participation/add-answer/add-answer.component.html index 6b8e926c..ac279450 100644 --- a/src/app/features/participation/add-answer/add-answer.component.html +++ b/src/app/features/participation/add-answer/add-answer.component.html @@ -12,7 +12,7 @@ class="button" [ngClass]="{ 'is-selected is-warning': answer == 'MAYBE' }" (click)="vote('MAYBE')" - *ngIf="poll.configuration.isMaybeAnswerAvailable" + *ngIf="poll.isMaybeAnswerAvailable" > MAYBE @@ -27,7 +27,7 @@ {{ choice.counts.get(answerEnum.YES) }} -