mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-29 21:53:53 +00:00
[v12.0/forgejo] fix: prevent pull requests from being merged multiple times (#8862)
Backport of https://codeberg.org/forgejo/forgejo/pulls/8842
Contains a partial cherry-pick of 184e068f37
, for the parts the PR depends on. The whole commit is way too involved to cherry-pick as a whole.
Co-authored-by: Danko Aleksejevs <danko@very.lv>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8862
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: BtbN <btbn@btbn.de>
Co-committed-by: BtbN <btbn@btbn.de>
This commit is contained in:
parent
97a27bb096
commit
53c4c6bda8
6 changed files with 92 additions and 4 deletions
|
@ -1445,6 +1445,10 @@ func MergePullRequest(ctx *context.Context) {
|
|||
log.Debug("MergeUnrelatedHistories error: %v", err)
|
||||
ctx.Flash.Error(ctx.Tr("repo.pulls.unrelated_histories"))
|
||||
ctx.JSONRedirect(issue.Link())
|
||||
} else if models.IsErrPullRequestHasMerged(err) {
|
||||
log.Debug("MergePullRequestHasMerged error: %v", err)
|
||||
ctx.Flash.Error(ctx.Tr("repo.pulls.already_merged"))
|
||||
ctx.JSONRedirect(issue.Link())
|
||||
} else if git.IsErrPushOutOfDate(err) {
|
||||
log.Debug("MergePushOutOfDate error: %v", err)
|
||||
ctx.Flash.Error(ctx.Tr("repo.pulls.merge_out_of_date"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue