mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-27 20:41:01 +00:00
[BUG] Return blocking errors as JSON errors
- These endspoints are sinceb71cb7acdcJSON-based and should therefore return JSON errors. - Integration tests adjusted. (cherry picked from commitd97cf0e854)
This commit is contained in:
parent
4d0be867a2
commit
d9010f5cfa
3 changed files with 46 additions and 20 deletions
|
|
@ -1508,8 +1508,7 @@ func CompareAndPullRequestPost(ctx *context.Context) {
|
|||
|
||||
if err := pull_service.NewPullRequest(ctx, repo, pullIssue, labelIDs, attachments, pullRequest, assigneeIDs); err != nil {
|
||||
if errors.Is(err, user_model.ErrBlockedByUser) {
|
||||
ctx.Flash.Error(ctx.Tr("repo.pulls.blocked_by_user"))
|
||||
ctx.Redirect(ctx.Link)
|
||||
ctx.JSONError(ctx.Tr("repo.pulls.blocked_by_user"))
|
||||
return
|
||||
} else if repo_model.IsErrUserDoesNotHaveAccessToRepo(err) {
|
||||
ctx.Error(http.StatusBadRequest, "UserDoesNotHaveAccessToRepo", err.Error())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue