summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
author赵智超 <1012112796@qq.com>2020-04-14 09:06:23 +0800
committerGitHub <noreply@github.com>2020-04-14 09:06:23 +0800
commit281029529bf98218b6c75353f2fce2d74b7ba196 (patch)
treec88354f13b20ddd024b167117c50a57cd11d92b7 /models
parent063b1d260fa5559fac0b77c215e8b06a9c083cec (diff)
downloadgitea-281029529bf98218b6c75353f2fce2d74b7ba196.tar.gz
gitea-281029529bf98218b6c75353f2fce2d74b7ba196.zip
ui: Add MergePull comment type instead of close for merge PR (#11058)
Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'models')
-rw-r--r--models/issue.go6
-rw-r--r--models/issue_comment.go2
-rw-r--r--models/pull.go2
3 files changed, 7 insertions, 3 deletions
diff --git a/models/issue.go b/models/issue.go
index ba211e9670..17ec0a6888 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -554,7 +554,7 @@ func updateIssueCols(e Engine, issue *Issue, cols ...string) error {
return nil
}
-func (issue *Issue) changeStatus(e *xorm.Session, doer *User, isClosed bool) (*Comment, error) {
+func (issue *Issue) changeStatus(e *xorm.Session, doer *User, isClosed, isMergePull bool) (*Comment, error) {
// Reload the issue
currentIssue, err := getIssueByID(e, issue.ID)
if err != nil {
@@ -620,6 +620,8 @@ func (issue *Issue) changeStatus(e *xorm.Session, doer *User, isClosed bool) (*C
cmtType := CommentTypeClose
if !issue.IsClosed {
cmtType = CommentTypeReopen
+ } else if isMergePull {
+ cmtType = CommentTypeMergePull
}
return createComment(e, &CreateCommentOptions{
@@ -645,7 +647,7 @@ func (issue *Issue) ChangeStatus(doer *User, isClosed bool) (*Comment, error) {
return nil, err
}
- comment, err := issue.changeStatus(sess, doer, isClosed)
+ comment, err := issue.changeStatus(sess, doer, isClosed, false)
if err != nil {
return nil, err
}
diff --git a/models/issue_comment.go b/models/issue_comment.go
index f522604afc..2e59a2cb3f 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -88,6 +88,8 @@ const (
CommentTypeDeleteTimeManual
// add or remove Request from one
CommentTypeReviewRequest
+ // merge pull request
+ CommentTypeMergePull
)
// CommentTag defines comment tag type
diff --git a/models/pull.go b/models/pull.go
index 02b5e98c49..055f9bbc6e 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -390,7 +390,7 @@ func (pr *PullRequest) SetMerged() (bool, error) {
return false, err
}
- if _, err := pr.Issue.changeStatus(sess, pr.Merger, true); err != nil {
+ if _, err := pr.Issue.changeStatus(sess, pr.Merger, true, true); err != nil {
return false, fmt.Errorf("Issue.changeStatus: %v", err)
}