Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4882221530 |
@@ -0,0 +1,4 @@
|
||||
# Test Webhook Notification
|
||||
|
||||
This file exists only to trigger a test webhook notification.
|
||||
Delete after testing.
|
||||
@@ -58,4 +58,4 @@ if [ -n "$MANUAL_USER_MAPPINGS" ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
exec ./gitea-notification-hub -config /app/config/config.yaml -debug
|
||||
exec ./gitea-notification-hub -config /app/config/config.yaml
|
||||
+13
-22
@@ -114,20 +114,15 @@ func (p *Processor) HandlePullRequest(e *webhook.PullRequestEvent) {
|
||||
|
||||
case "review_requested":
|
||||
event.Type = TypePRReviewRequested
|
||||
if len(event.Reviewers) > 0 {
|
||||
for _, u := range event.Reviewers {
|
||||
p.logger.Debug().Str("requested_reviewer", u.GiteaUsername).Msg("review_requested event")
|
||||
// Notify newly requested reviewers (array)
|
||||
if len(e.RequestedReviewers) > 0 {
|
||||
for _, reviewer := range e.RequestedReviewers {
|
||||
p.logger.Debug().Str("requested_reviewer", reviewer.Login).Msg("review_requested event")
|
||||
usersToNotify = append(usersToNotify, struct {
|
||||
user User
|
||||
reason NotificationReason
|
||||
}{u, ReasonReviewer})
|
||||
}{giteaUserToUser(reviewer), 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 {
|
||||
p.logger.Debug().Msg("review_requested event but no RequestedReviewers field")
|
||||
}
|
||||
@@ -175,18 +170,14 @@ func (p *Processor) HandlePullRequest(e *webhook.PullRequestEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the actor from notifications (don't notify yourself) - but SKIP for review_requested because CI automation may request as same user
|
||||
if e.Action == "review_requested" {
|
||||
p.logger.Debug().Str("actor", event.Actor.GiteaUsername).Msg("skipping actor filter for review_requested (CI automation)")
|
||||
} else {
|
||||
beforeFilter := len(usersToNotify)
|
||||
usersToNotify = p.filterOutActor(usersToNotify, event.Actor)
|
||||
p.logger.Debug().
|
||||
Int("before_filter", beforeFilter).
|
||||
Int("after_filter", len(usersToNotify)).
|
||||
Str("actor_filtered", event.Actor.GiteaUsername).
|
||||
Msg("filtered out actor from notifications")
|
||||
}
|
||||
// Remove the actor from notifications (don't notify yourself)
|
||||
beforeFilter := len(usersToNotify)
|
||||
usersToNotify = p.filterOutActor(usersToNotify, event.Actor)
|
||||
p.logger.Debug().
|
||||
Int("before_filter", beforeFilter).
|
||||
Int("after_filter", len(usersToNotify)).
|
||||
Str("actor_filtered", event.Actor.GiteaUsername).
|
||||
Msg("filtered out actor from notifications")
|
||||
|
||||
// Send notifications
|
||||
p.sendNotifications(ctx, event, usersToNotify)
|
||||
|
||||
Reference in New Issue
Block a user