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) } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 9a1a458f66..8b43115c07 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -925,6 +925,7 @@ issues.context.edit = Edit issues.context.delete = Delete issues.no_content = There is no content yet. issues.close_issue = Close +issues.pull_merged_at = `merged commit %[2]s into %[3]s %[4]s` issues.close_comment_issue = Comment and Close issues.reopen_issue = Reopen issues.reopen_comment_issue = Comment and Reopen diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index dc7d2db3c6..da1483ec37 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -7,7 +7,7 @@ 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE, 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE, 22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED, 25 = TARGET_BRANCH_CHANGED, - 26 = DELETE_TIME_MANUAL, 27 = REVIEW_REQUEST --> + 26 = DELETE_TIME_MANUAL, 27 = REVIEW_REQUEST, 28 = MERGE_PULL_REQUEST --> {{if eq .Type 0}}