fix(ui): display user-friendly message for range error (#7420)
- Instead of displaying 'RangeError: Range' display 'x must be a number between $MIN and $MAX' when the validation fails for a range error check. - Resolves forgejo/forgejo#3510 - Added integration testing. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7420 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
parent
15a2338ff2
commit
5706a2452e
4 changed files with 88 additions and 2 deletions
|
@ -725,8 +725,8 @@ func (f *DeleteRepoFileForm) Validate(req *http.Request, errs binding.Errors) bi
|
|||
|
||||
// AddTimeManuallyForm form that adds spent time manually.
|
||||
type AddTimeManuallyForm struct {
|
||||
Hours int `binding:"Range(0,1000)"`
|
||||
Minutes int `binding:"Range(0,1000)"`
|
||||
Hours int `binding:"Range(0,1000)" locale:"repo.issues.add_time_hours"`
|
||||
Minutes int `binding:"Range(0,1000)" locale:"repo.issues.add_time_minutes"`
|
||||
}
|
||||
|
||||
// Validate validates the fields
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue