From 63e5db5d7a09bc3a223c551f921e3401366fd1f8 Mon Sep 17 00:00:00 2001 From: John Olheiser Date: Wed, 18 Jan 2023 15:50:51 -0600 Subject: [PATCH] Fix 500 error viewing pull request when fork has pull requests disabled (#22512) (#22515) Backport #22512 Co-authored-by: Brecht Van Lommel --- services/pull/update.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/pull/update.go b/services/pull/update.go index bd4880a2fc..8aed60e070 100644 --- a/services/pull/update.go +++ b/services/pull/update.go @@ -109,6 +109,9 @@ func IsUserAllowedToUpdate(ctx context.Context, pull *issues_model.PullRequest, if pr.ProtectedBranch == nil { prUnit, err := pr.BaseRepo.GetUnit(unit.TypePullRequests) if err != nil { + if repo_model.IsErrUnitTypeNotExist(err) { + return false, false, nil + } log.Error("pr.BaseRepo.GetUnit(unit.TypePullRequests): %v", err) return false, false, err }