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>
This commit is contained in:
parent
063b1d260f
commit
281029529b
|
@ -554,7 +554,7 @@ func updateIssueCols(e Engine, issue *Issue, cols ...string) error {
|
||||||
return nil
|
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
|
// Reload the issue
|
||||||
currentIssue, err := getIssueByID(e, issue.ID)
|
currentIssue, err := getIssueByID(e, issue.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -620,6 +620,8 @@ func (issue *Issue) changeStatus(e *xorm.Session, doer *User, isClosed bool) (*C
|
||||||
cmtType := CommentTypeClose
|
cmtType := CommentTypeClose
|
||||||
if !issue.IsClosed {
|
if !issue.IsClosed {
|
||||||
cmtType = CommentTypeReopen
|
cmtType = CommentTypeReopen
|
||||||
|
} else if isMergePull {
|
||||||
|
cmtType = CommentTypeMergePull
|
||||||
}
|
}
|
||||||
|
|
||||||
return createComment(e, &CreateCommentOptions{
|
return createComment(e, &CreateCommentOptions{
|
||||||
|
@ -645,7 +647,7 @@ func (issue *Issue) ChangeStatus(doer *User, isClosed bool) (*Comment, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
comment, err := issue.changeStatus(sess, doer, isClosed)
|
comment, err := issue.changeStatus(sess, doer, isClosed, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,8 @@ const (
|
||||||
CommentTypeDeleteTimeManual
|
CommentTypeDeleteTimeManual
|
||||||
// add or remove Request from one
|
// add or remove Request from one
|
||||||
CommentTypeReviewRequest
|
CommentTypeReviewRequest
|
||||||
|
// merge pull request
|
||||||
|
CommentTypeMergePull
|
||||||
)
|
)
|
||||||
|
|
||||||
// CommentTag defines comment tag type
|
// CommentTag defines comment tag type
|
||||||
|
|
|
@ -390,7 +390,7 @@ func (pr *PullRequest) SetMerged() (bool, error) {
|
||||||
return false, err
|
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)
|
return false, fmt.Errorf("Issue.changeStatus: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -925,6 +925,7 @@ issues.context.edit = Edit
|
||||||
issues.context.delete = Delete
|
issues.context.delete = Delete
|
||||||
issues.no_content = There is no content yet.
|
issues.no_content = There is no content yet.
|
||||||
issues.close_issue = Close
|
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.close_comment_issue = Comment and Close
|
||||||
issues.reopen_issue = Reopen
|
issues.reopen_issue = Reopen
|
||||||
issues.reopen_comment_issue = Comment and Reopen
|
issues.reopen_comment_issue = Comment and Reopen
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE,
|
13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE,
|
||||||
18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE,
|
18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE,
|
||||||
22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED, 25 = TARGET_BRANCH_CHANGED,
|
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}}
|
{{if eq .Type 0}}
|
||||||
<div class="timeline-item comment" id="{{.HashTag}}">
|
<div class="timeline-item comment" id="{{.HashTag}}">
|
||||||
{{if .OriginalAuthor }}
|
{{if .OriginalAuthor }}
|
||||||
|
@ -84,6 +84,18 @@
|
||||||
</a>
|
</a>
|
||||||
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}}</span>
|
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}}</span>
|
||||||
</div>
|
</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}}
|
{{else if eq .Type 3 5 6}}
|
||||||
{{ $refFrom:= "" }}
|
{{ $refFrom:= "" }}
|
||||||
{{if ne .RefRepoID .Issue.RepoID}}
|
{{if ne .RefRepoID .Issue.RepoID}}
|
||||||
|
|
Loading…
Reference in New Issue