about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Ivanov <saiv46.dev@gmail.com>2023-01-05 20:29:49 +0800
committerGitHub <noreply@github.com>2023-01-05 13:29:49 +0100
commit8eb29741b440e3eeac297ec89a49a3fb1c9deb8d (patch)
tree43d26f073ee1952ca1095fe08f911bafe64fa7eb
parent17f79082b098e05b68d6f0d38fabb3ac121879a9 (diff)
Add webhook `account.approved` (#22938)
* Webhook `account.approved` when preparing new user

* Update Webhook.EVENTS
-rw-r--r--app/models/user.rb1
-rw-r--r--app/models/webhook.rb1
2 files changed, 2 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index ca98a0afa..2a42ffaa1 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -489,6 +489,7 @@ class User < ApplicationRecord
     BootstrapTimelineWorker.perform_async(account_id)
     ActivityTracker.increment('activity:accounts:local')
     UserMailer.welcome(self).deliver_later
+    TriggerWebhookWorker.perform_async('account.approved', 'Account', account_id)
   end
 
   def prepare_returning_user!
diff --git a/app/models/webhook.rb b/app/models/webhook.rb
index 431edd75d..4aafb1257 100644
--- a/app/models/webhook.rb
+++ b/app/models/webhook.rb
@@ -15,6 +15,7 @@
 
 class Webhook < ApplicationRecord
   EVENTS = %w(
+    account.approved
     account.created
     report.created
   ).freeze