Update dashboard context for PR reviews (#8995)
* Update dashboard context for PR reviews Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update options/locale/locale_en-US.ini Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Only append head action if it has content or is approval/rejection Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update options/locale/locale_en-US.ini Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
This commit is contained in:
parent
dd1beee2ef
commit
06a8504c78
5 changed files with 50 additions and 26 deletions
|
@ -148,18 +148,28 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
|
|||
}
|
||||
}
|
||||
|
||||
if strings.TrimSpace(comment.Content) != "" {
|
||||
actions = append(actions, &models.Action{
|
||||
if review.Type != models.ReviewTypeComment || strings.TrimSpace(comment.Content) != "" {
|
||||
action := &models.Action{
|
||||
ActUserID: review.Reviewer.ID,
|
||||
ActUser: review.Reviewer,
|
||||
Content: fmt.Sprintf("%d|%s", review.Issue.Index, strings.Split(comment.Content, "\n")[0]),
|
||||
OpType: models.ActionCommentIssue,
|
||||
RepoID: review.Issue.RepoID,
|
||||
Repo: review.Issue.Repo,
|
||||
IsPrivate: review.Issue.Repo.IsPrivate,
|
||||
Comment: comment,
|
||||
CommentID: comment.ID,
|
||||
})
|
||||
}
|
||||
|
||||
switch review.Type {
|
||||
case models.ReviewTypeApprove:
|
||||
action.OpType = models.ActionApprovePullRequest
|
||||
case models.ReviewTypeReject:
|
||||
action.OpType = models.ActionRejectPullRequest
|
||||
default:
|
||||
action.OpType = models.ActionCommentIssue
|
||||
}
|
||||
|
||||
actions = append(actions, action)
|
||||
}
|
||||
|
||||
if err := models.NotifyWatchersActions(actions); err != nil {
|
||||
|
|
|
@ -555,6 +555,10 @@ func ActionIcon(opType models.ActionType) string {
|
|||
return "issue-reopened"
|
||||
case models.ActionMirrorSyncPush, models.ActionMirrorSyncCreate, models.ActionMirrorSyncDelete:
|
||||
return "repo-clone"
|
||||
case models.ActionApprovePullRequest:
|
||||
return "eye"
|
||||
case models.ActionRejectPullRequest:
|
||||
return "x"
|
||||
default:
|
||||
return "invalid type"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue