fix: don't filter actor for review_requested to allow CI self-request (fixes PR 185)
This commit is contained in:
@@ -175,7 +175,10 @@ func (p *Processor) HandlePullRequest(e *webhook.PullRequestEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the actor from notifications (don't notify yourself)
|
// 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)
|
beforeFilter := len(usersToNotify)
|
||||||
usersToNotify = p.filterOutActor(usersToNotify, event.Actor)
|
usersToNotify = p.filterOutActor(usersToNotify, event.Actor)
|
||||||
p.logger.Debug().
|
p.logger.Debug().
|
||||||
@@ -183,6 +186,7 @@ func (p *Processor) HandlePullRequest(e *webhook.PullRequestEvent) {
|
|||||||
Int("after_filter", len(usersToNotify)).
|
Int("after_filter", len(usersToNotify)).
|
||||||
Str("actor_filtered", event.Actor.GiteaUsername).
|
Str("actor_filtered", event.Actor.GiteaUsername).
|
||||||
Msg("filtered out actor from notifications")
|
Msg("filtered out actor from notifications")
|
||||||
|
}
|
||||||
|
|
||||||
// Send notifications
|
// Send notifications
|
||||||
p.sendNotifications(ctx, event, usersToNotify)
|
p.sendNotifications(ctx, event, usersToNotify)
|
||||||
@@ -402,10 +406,10 @@ func (p *Processor) sendNotifications(ctx context.Context, event *Event, users [
|
|||||||
// filterOutActor removes the event actor from the notification list
|
// filterOutActor removes the event actor from the notification list
|
||||||
func (p *Processor) filterOutActor(users []struct {
|
func (p *Processor) filterOutActor(users []struct {
|
||||||
user User
|
user User
|
||||||
reason NotificationReason
|
reason NotificationReasol
|
||||||
}, actor User) []struct {
|
}, actor User) []struct {
|
||||||
user User
|
user User
|
||||||
reason NotificationReason
|
reason NotificationReasol
|
||||||
} {
|
} {
|
||||||
var filtered []struct {
|
var filtered []struct {
|
||||||
user User
|
user User
|
||||||
|
|||||||
Reference in New Issue
Block a user