mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-24 12:43:08 +02:00
Add new comment types for WIP prefix changes
- Added CommentTypeMarkedAsWorkInProgress and CommentTypeMarkedAsReadyForReview - Updated ChangeIssueTitle to detect WIP prefix changes - Added locale strings for the new messages - Updated template to render new comment types Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>
This commit is contained in:
parent
c2cf234a4e
commit
5d3ecb1399
@ -116,6 +116,9 @@ const (
|
|||||||
CommentTypeUnpin // 37 unpin Issue/PullRequest
|
CommentTypeUnpin // 37 unpin Issue/PullRequest
|
||||||
|
|
||||||
CommentTypeChangeTimeEstimate // 38 Change time estimate
|
CommentTypeChangeTimeEstimate // 38 Change time estimate
|
||||||
|
|
||||||
|
CommentTypeMarkedAsWorkInProgress // 39 Mark PR as work in progress
|
||||||
|
CommentTypeMarkedAsReadyForReview // 40 Mark PR as ready for review
|
||||||
)
|
)
|
||||||
|
|
||||||
var commentStrings = []string{
|
var commentStrings = []string{
|
||||||
@ -158,6 +161,8 @@ var commentStrings = []string{
|
|||||||
"pin",
|
"pin",
|
||||||
"unpin",
|
"unpin",
|
||||||
"change_time_estimate",
|
"change_time_estimate",
|
||||||
|
"marked_as_work_in_progress",
|
||||||
|
"marked_as_ready_for_review",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t CommentType) String() string {
|
func (t CommentType) String() string {
|
||||||
|
|||||||
@ -209,8 +209,23 @@ func ChangeIssueTitle(ctx context.Context, issue *Issue, doer *user_model.User,
|
|||||||
return fmt.Errorf("loadRepo: %w", err)
|
return fmt.Errorf("loadRepo: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine the comment type based on WIP prefix changes for pull requests
|
||||||
|
commentType := CommentTypeChangeTitle
|
||||||
|
if issue.IsPull {
|
||||||
|
hadWIP := HasWorkInProgressPrefix(oldTitle)
|
||||||
|
hasWIP := HasWorkInProgressPrefix(issue.Title)
|
||||||
|
|
||||||
|
if !hadWIP && hasWIP {
|
||||||
|
// WIP prefix was added
|
||||||
|
commentType = CommentTypeMarkedAsWorkInProgress
|
||||||
|
} else if hadWIP && !hasWIP {
|
||||||
|
// WIP prefix was removed
|
||||||
|
commentType = CommentTypeMarkedAsReadyForReview
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
opts := &CreateCommentOptions{
|
opts := &CreateCommentOptions{
|
||||||
Type: CommentTypeChangeTitle,
|
Type: commentType,
|
||||||
Doer: doer,
|
Doer: doer,
|
||||||
Repo: issue.Repo,
|
Repo: issue.Repo,
|
||||||
Issue: issue,
|
Issue: issue,
|
||||||
|
|||||||
@ -1447,6 +1447,8 @@
|
|||||||
"repo.issues.remove_assignee_at": "was unassigned by <b>%s</b> %s",
|
"repo.issues.remove_assignee_at": "was unassigned by <b>%s</b> %s",
|
||||||
"repo.issues.remove_self_assignment": "removed their assignment %s",
|
"repo.issues.remove_self_assignment": "removed their assignment %s",
|
||||||
"repo.issues.change_title_at": "changed title from <b><strike>%s</strike></b> to <b>%s</b> %s",
|
"repo.issues.change_title_at": "changed title from <b><strike>%s</strike></b> to <b>%s</b> %s",
|
||||||
|
"repo.issues.marked_as_work_in_progress": "marked the pull request as work in progress %s",
|
||||||
|
"repo.issues.marked_as_ready_for_review": "marked the pull request as ready for review %s",
|
||||||
"repo.issues.change_ref_at": "changed reference from <b><strike>%s</strike></b> to <b>%s</b> %s",
|
"repo.issues.change_ref_at": "changed reference from <b><strike>%s</strike></b> to <b>%s</b> %s",
|
||||||
"repo.issues.remove_ref_at": "removed reference <b>%s</b> %s",
|
"repo.issues.remove_ref_at": "removed reference <b>%s</b> %s",
|
||||||
"repo.issues.add_ref_at": "added reference <b>%s</b> %s",
|
"repo.issues.add_ref_at": "added reference <b>%s</b> %s",
|
||||||
|
|||||||
@ -13,7 +13,8 @@
|
|||||||
29 = PULL_PUSH_EVENT, 30 = PROJECT_CHANGED, 31 = PROJECT_BOARD_CHANGED
|
29 = PULL_PUSH_EVENT, 30 = PROJECT_CHANGED, 31 = PROJECT_BOARD_CHANGED
|
||||||
32 = DISMISSED_REVIEW, 33 = COMMENT_TYPE_CHANGE_ISSUE_REF, 34 = PR_SCHEDULE_TO_AUTO_MERGE,
|
32 = DISMISSED_REVIEW, 33 = COMMENT_TYPE_CHANGE_ISSUE_REF, 34 = PR_SCHEDULE_TO_AUTO_MERGE,
|
||||||
35 = CANCEL_SCHEDULED_AUTO_MERGE_PR, 36 = PIN_ISSUE, 37 = UNPIN_ISSUE,
|
35 = CANCEL_SCHEDULED_AUTO_MERGE_PR, 36 = PIN_ISSUE, 37 = UNPIN_ISSUE,
|
||||||
38 = COMMENT_TYPE_CHANGE_TIME_ESTIMATE -->
|
38 = COMMENT_TYPE_CHANGE_TIME_ESTIMATE, 39 = MARKED_AS_WORK_IN_PROGRESS,
|
||||||
|
40 = MARKED_AS_READY_FOR_REVIEW -->
|
||||||
{{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}}
|
||||||
@ -692,6 +693,24 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
{{else if eq .Type 39}}
|
||||||
|
<div class="timeline-item event" id="{{.HashTag}}">
|
||||||
|
<span class="badge">{{svg "octicon-x-circle"}}</span>
|
||||||
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
||||||
|
<span class="comment-text-line">
|
||||||
|
{{template "shared/user/authorlink" .Poster}}
|
||||||
|
{{ctx.Locale.Tr "repo.issues.marked_as_work_in_progress" $createdStr}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{{else if eq .Type 40}}
|
||||||
|
<div class="timeline-item event" id="{{.HashTag}}">
|
||||||
|
<span class="badge">{{svg "octicon-check-circle"}}</span>
|
||||||
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
||||||
|
<span class="comment-text-line">
|
||||||
|
{{template "shared/user/authorlink" .Poster}}
|
||||||
|
{{ctx.Locale.Tr "repo.issues.marked_as_ready_for_review" $createdStr}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user