File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -679,7 +679,13 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
679
679
return
680
680
}
681
681
if issue .IsClosed {
682
- ctx .NotFound ("MergePullRequest" , nil )
682
+ if issue .IsPull {
683
+ ctx .Flash .Error (ctx .Tr ("repo.pulls.is_closed" ))
684
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com .ToStr (issue .Index ))
685
+ return
686
+ }
687
+ ctx .Flash .Error (ctx .Tr ("repo.issues.closed_title" ))
688
+ ctx .Redirect (ctx .Repo .RepoLink + "/issues/" + com .ToStr (issue .Index ))
683
689
return
684
690
}
685
691
@@ -691,12 +697,20 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
691
697
return
692
698
}
693
699
if ! allowedMerge {
694
- ctx .NotFound ("MergePullRequest" , nil )
700
+ ctx .Flash .Error (ctx .Tr ("repo.pulls.update_not_allowed" ))
701
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com .ToStr (issue .Index ))
695
702
return
696
703
}
697
704
698
- if ! pr .CanAutoMerge () || pr .HasMerged {
699
- ctx .NotFound ("MergePullRequest" , nil )
705
+ if ! pr .CanAutoMerge () {
706
+ ctx .Flash .Error (ctx .Tr ("repo.pulls.no_merge_not_ready" ))
707
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com .ToStr (issue .Index ))
708
+ return
709
+ }
710
+
711
+ if pr .HasMerged {
712
+ ctx .Flash .Error (ctx .Tr ("repo.pulls.has_merged" ))
713
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com .ToStr (issue .Index ))
700
714
return
701
715
}
702
716
You can’t perform that action at this time.
0 commit comments