Skip to content

Commit

Permalink
fix: Allow longer feedback and warn users if their feedback is too long
Browse files Browse the repository at this point in the history
The previous limit of 255 was a bit too short, so raise it to 500. Add a client-side warning about
the feedback being too long instead of making users run into a server-side error.
  • Loading branch information
zusorio committed Nov 4, 2024
1 parent 633bcff commit ab801d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/capellacollab/feedback/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Feedback(core_pydantic.BaseModel):
description="The rating of the feedback"
)
feedback_text: str | None = pydantic.Field(
description="The feedback text", max_length=255
description="The feedback text", max_length=500
)
share_contact: bool = pydantic.Field(
description="Whether the user wants to share their contact information"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ <h1 class="text-lg font-semibold">
formControlName="feedbackText"
data-testid="feedback-text"
></textarea>
@if (feedbackForm.controls.feedbackText.hasError("maxlength")) {
<mat-error>
Your feedback can't be longer than 500 characters.
</mat-error>
}
<mat-hint
>Try to be specific. What happened? What were you doing?</mat-hint
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export class FeedbackDialogComponent {
undefined,
Validators.required,
),
feedbackText: new FormControl<string>(''),
feedbackText: new FormControl<string>('', {
validators: [Validators.maxLength(500)],
}),
shareContact: new FormControl<boolean>(true),
});

Expand Down

0 comments on commit ab801d7

Please sign in to comment.