|
|
@ -679,7 +679,13 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if issue.IsClosed { |
|
|
|
if issue.IsClosed { |
|
|
|
ctx.NotFound("MergePullRequest", nil) |
|
|
|
if issue.IsPull { |
|
|
|
|
|
|
|
ctx.Flash.Error(ctx.Tr("repo.pulls.is_closed")) |
|
|
|
|
|
|
|
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(issue.Index)) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ctx.Flash.Error(ctx.Tr("repo.issues.closed_title")) |
|
|
|
|
|
|
|
ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + com.ToStr(issue.Index)) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -691,12 +697,20 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if !allowedMerge { |
|
|
|
if !allowedMerge { |
|
|
|
ctx.NotFound("MergePullRequest", nil) |
|
|
|
ctx.Flash.Error(ctx.Tr("repo.pulls.update_not_allowed")) |
|
|
|
|
|
|
|
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(issue.Index)) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if !pr.CanAutoMerge() || pr.HasMerged { |
|
|
|
if !pr.CanAutoMerge() { |
|
|
|
ctx.NotFound("MergePullRequest", nil) |
|
|
|
ctx.Flash.Error(ctx.Tr("repo.pulls.no_merge_not_ready")) |
|
|
|
|
|
|
|
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(issue.Index)) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if pr.HasMerged { |
|
|
|
|
|
|
|
ctx.Flash.Error(ctx.Tr("repo.pulls.has_merged")) |
|
|
|
|
|
|
|
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(issue.Index)) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|