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 4fb5796d6b - Show all commits

View File

@ -147,11 +147,12 @@ def handle_modifications(sender, user: UserModel, **kwargs):
app__in=user.bid_main_oauth2accesstoken.distinct().values_list('application', flat=True) app__in=user.bid_main_oauth2accesstoken.distinct().values_list('application', flat=True)
) )
if not hooks.count(): hooks_count = hooks.count()
if hooks_count == 0:
log.info('Not sending modification of pk=%d to any webhooks', user.pk) log.info('Not sending modification of pk=%d to any webhooks', user.pk)
return return
log.info("Sending modification of pk=%d to %d webhooks", user.pk, len(hooks)) log.info("Sending modification of pk=%d to %d webhooks", user.pk, hooks_count)
# Do our own JSON encoding so that we can compute the HMAC using the hook's secret. # Do our own JSON encoding so that we can compute the HMAC using the hook's secret.
payload = { payload = {