diff options
-rw-r--r-- | models/issue.go | 6 | ||||
-rw-r--r-- | models/issue_comment.go | 2 | ||||
-rw-r--r-- | models/pull.go | 2 | ||||
-rw-r--r-- | options/locale/locale_en-US.ini | 1 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 14 |
5 files changed, 21 insertions, 4 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) } 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 <a href="%[1]s">%[2]s</a> into <b>%[3]s</b> %[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}} <div class="timeline-item comment" id="{{.HashTag}}"> {{if .OriginalAuthor }} @@ -84,6 +84,18 @@ </a> <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}}</span> </div> + {{else if eq .Type 28}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge purple">{{svg "octicon-git-merge" 16}}</span> + <a class="ui avatar image" href="{{.Poster.HomeLink}}"> + <img src="{{.Poster.RelAvatarLink}}"> + </a> + <span class="text grey"> + <a href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$link := printf "%s/commit/%s" $.Repository.HTMLURL $.Issue.PullRequest.MergedCommitID}} + {{$.i18n.Tr "repo.issues.pull_merged_at" $link (ShortSha $.Issue.PullRequest.MergedCommitID) $.BaseTarget $createdStr | Str2html}} + </span> + </div> {{else if eq .Type 3 5 6}} {{ $refFrom:= "" }} {{if ne .RefRepoID .Issue.RepoID}} |