mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-27 05:22:13 -04:00
### Problem When a user clicks the merge button on a pull request and their quota is exceeded, the UI displays ( cf screenshot ): > Network error SyntaxError: Unexpected token 'Q', "Quota exceeded." is not valid JSON ### Fix Read the response body as text first with `resp.text()`, then attempt `JSON.parse()`. If parsing succeeds, use the existing `errorMessage` logic. If it fails, display the raw text directly in the error toast. This is the same approach already used by Dropzone for attachment uploads, where the `error` event handler passes the response body directly to `showErrorToast`. ( cf screenshot ) ### Tests for JavaScript changes The function is not exported, I cannot create a unit test. Do you want me to export all the logic in an exported function ? ### Release notes - [X] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12635 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org> |
||
|---|---|---|
| .. | ||
| css | ||
| fomantic | ||
| js | ||
| svg | ||