Send user-modified only to webhooks of relevant OAuth apps #93585

Closed
Anna Sirota wants to merge 5 commits from webhook-oauth-app-required into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 6aee840c38 - Show all commits

View File

@ -143,11 +143,13 @@ def handle_modifications(sender, user: UserModel, **kwargs):
log.debug("User changed email from %s to %s", old_email, user.email)
user_email_changed.send(sender, user=user, old_email=old_email)
hooks = models.Webhook.objects.filter(enabled=True).filter(
app__in=user.bid_main_oauth2accesstoken.distinct().values_list('application', flat=True)
hooks = list(
models.Webhook.objects.filter(enabled=True).filter(
app__in=user.bid_main_oauth2accesstoken.distinct().values_list('application', flat=True)
)
)
hooks_count = hooks.count()
hooks_count = len(hooks)
if hooks_count == 0:
log.info('Not sending modification of pk=%d to any webhooks', user.pk)
return