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) }} -