fix: review_requested uses normalized reviewers (fixes PR 184 slack notification)
This commit is contained in:
@@ -114,15 +114,20 @@ func (p *Processor) HandlePullRequest(e *webhook.PullRequestEvent) {
|
|||||||
|
|
||||||
case "review_requested":
|
case "review_requested":
|
||||||
event.Type = TypePRReviewRequested
|
event.Type = TypePRReviewRequested
|
||||||
// Notify newly requested reviewers (array)
|
if len(event.Reviewers) > 0 {
|
||||||
if len(e.RequestedReviewers) > 0 {
|
for _, u := range event.Reviewers {
|
||||||
for _, reviewer := range e.RequestedReviewers {
|
p.logger.Debug().Str("requested_reviewer", u.GiteaUsername).Msg("review_requested event")
|
||||||
p.logger.Debug().Str("requested_reviewer", reviewer.Login).Msg("review_requested event")
|
|
||||||
usersToNotify = append(usersToNotify, struct {
|
usersToNotify = append(usersToNotify, struct {
|
||||||
user User
|
user User
|
||||||
reason NotificationReason
|
reason NotificationReason
|
||||||
}{giteaUserToUser(reviewer), ReasonReviewer})
|
}{u, ReasonReviewer})
|
||||||
}
|
}
|
||||||
|
} else if e.RequestedReviewer != nil {
|
||||||
|
p.logger.Debug().Str("requested_reviewer", e.RequestedReviewer.Login).Msg("review_requested event")
|
||||||
|
usersToNotify = append(usersToNotify, struct {
|
||||||
|
user User
|
||||||
|
reason NotificationReason
|
||||||
|
}{giteaUserToUser(*e.RequestedReviewer), ReasonReviewer})
|
||||||
} else {
|
} else {
|
||||||
p.logger.Debug().Msg("review_requested event but no RequestedReviewers field")
|
p.logger.Debug().Msg("review_requested event but no RequestedReviewers field")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user