|
|
|
@@ -590,12 +590,28 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if err := stopTimerIfAvailable(ctx.User, issue); err != nil { |
|
|
|
ctx.ServerError("CreateOrStopIssueStopwatch", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
notification.NotifyMergePullRequest(pr, ctx.User, ctx.Repo.GitRepo) |
|
|
|
|
|
|
|
log.Trace("Pull request merged: %d", pr.ID) |
|
|
|
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index)) |
|
|
|
} |
|
|
|
|
|
|
|
func stopTimerIfAvailable(user *models.User, issue *models.Issue) error { |
|
|
|
|
|
|
|
if models.StopwatchExists(user.ID, issue.ID) { |
|
|
|
if err := models.CreateOrStopIssueStopwatch(user, issue); err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
// ParseCompareInfo parse compare info between two commit for preparing pull request |
|
|
|
func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *git.Repository, *git.PullRequestInfo, string, string) { |
|
|
|
baseRepo := ctx.Repo.Repository |
|
|
|
|