Skip to content

Commit fc762f5

Browse files
committed
client: remove hack to handle undefined value for feedback context property
- we added the property manually for all drafts in Firebstore
1 parent c962e38 commit fc762f5

4 files changed

Lines changed: 2 additions & 10 deletions

File tree

client/src/app/give-feedback/give-feedback/give-feedback.component.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ export class GiveFeedbackComponent implements LeaveForm, OnDestroy {
112112
}),
113113
)
114114
.subscribe((draft) => {
115-
// WARNING:
116-
// The `context` field may not be present in the `draft` object, because it was added to the feedback type later.
117-
// Therefore DO NOT use `.setValue()` instead of `.patchValue()`, otherwise it will fail for old draft objects.
118115
this.form.patchValue(draft);
119116
this.form.updateValueAndValidity();
120117
this.leaveFormService.takeSnapshot();

client/src/app/give-feedback/give-requested-feedback/give-requested-feedback.component.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ export class GiveRequestedFeedbackComponent implements GiveRequestedFeedbackData
8080
ngOnInit(): void {
8181
const draft = this.draft();
8282
if (draft) {
83-
// WARNING:
84-
// The `context` field may not be present in the `draft` object, because it was added to the feedback type later.
85-
// Therefore DO NOT use `.setValue()` instead of `.patchValue()`, otherwise it will fail for old draft objects.
8683
this.form.patchValue(draft);
8784
this.form.updateValueAndValidity();
8885
this.leaveFormService.takeSnapshot();

client/src/app/give-feedback/shared/give-feedback-details/give-feedback-details.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
i18n-placeholder="@@Component.GiveFeedbackDetails.ContextPlaceholder"
1313
></textarea>
1414

15-
<mat-hint align="end">{{ context().value?.length ?? 0 }} / {{ contextMaxLength }}</mat-hint>
15+
<mat-hint align="end">{{ context().value.length }} / {{ contextMaxLength }}</mat-hint>
1616
</mat-form-field>
1717

1818
<mat-form-field appearance="outline" class="gbl-form-field">

client/src/app/give-feedback/shared/give-feedback-details/give-feedback-details.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ export class GiveFeedbackDetailsComponent implements OnInit {
3636

3737
protected commentMaxLength = MEDIUM_MAX_LENGTH;
3838

39-
// WARNING:
40-
// The `context` field may not be present in the `draft` object, because it was added to the feedback type later.
41-
context = input.required<FormControl<string | undefined>>();
39+
context = input.required<FormControl<string>>();
4240

4341
positive = input.required<FormControl<string>>();
4442

0 commit comments

Comments
 (0)