summaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-10-25 03:10:22 -0400
committerUnknwon <u@gogs.io>2015-10-25 03:10:22 -0400
commitc3ba5590c98a32c149c4dfa97bbfed65135d4f3e (patch)
tree8dd9ba8116d2616a1ce8c7db7b893ce702ed50ad /routers/repo
parent379629d28ac5e4f7feb8ab6df8f0488d7dc5e69f (diff)
downloadgitea-c3ba5590c98a32c149c4dfa97bbfed65135d4f3e.tar.gz
gitea-c3ba5590c98a32c149c4dfa97bbfed65135d4f3e.zip
Reopen PR need retest patch
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/issue.go22
-rw-r--r--routers/repo/pull.go5
2 files changed, 26 insertions, 1 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 166b369dca..30dcf92578 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -476,6 +476,11 @@ func ViewIssue(ctx *middleware.Context) {
}
if issue.IsPull {
+ if err = issue.GetPullRequest(); err != nil {
+ ctx.Handle(500, "GetPullRequest", err)
+ return
+ }
+
ctx.Data["PageIsPullList"] = true
ctx.Data["PageIsPullConversation"] = true
} else {
@@ -747,6 +752,12 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) {
}
return
}
+ if issue.IsPull {
+ if err = issue.GetPullRequest(); err != nil {
+ ctx.Handle(500, "GetPullRequest", err)
+ return
+ }
+ }
var attachments []string
if setting.AttachmentEnabled {
@@ -766,6 +777,7 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) {
(form.Status == "reopen" || form.Status == "close") &&
!(issue.IsPull && issue.HasMerged) {
+ // Duplication and conflict check should apply to reopen pull request.
var pr *models.PullRequest
if form.Status == "reopen" && issue.IsPull {
@@ -777,6 +789,16 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) {
return
}
}
+
+ // Regenerate patch and test conflict.
+ if pr == nil {
+ if err = issue.UpdatePatch(); err != nil {
+ ctx.Handle(500, "UpdatePatch", err)
+ return
+ }
+
+ issue.AddToTaskQueue()
+ }
}
if pr != nil {
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index eade4407f7..b69592411b 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -149,7 +149,10 @@ func checkPullInfo(ctx *middleware.Context) *models.Issue {
if err = issue.GetPoster(); err != nil {
ctx.Handle(500, "GetPoster", err)
return nil
- } else if issue.GetHeadRepo(); err != nil {
+ } else if err = issue.GetPullRequest(); err != nil {
+ ctx.Handle(500, "GetPullRequest", err)
+ return nil
+ } else if err = issue.GetHeadRepo(); err != nil {
ctx.Handle(500, "GetHeadRepo", err)
return nil
}