use webhook urls instead of encrypted configs
This commit is contained in:
committed by
Pete Matsyburka
parent
f669045362
commit
84edb6dbda
@@ -22,5 +22,6 @@ class Ability
|
||||
can :manage, UserConfig, user_id: user.id
|
||||
can :manage, Account, id: user.account_id
|
||||
can :manage, AccessToken, user_id: user.id
|
||||
can :manage, WebhookUrl, account_id: user.account_id
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,30 +78,6 @@ module Accounts
|
||||
new_template
|
||||
end
|
||||
|
||||
def load_webhook_url(account)
|
||||
load_webhook_config(account)&.value.presence
|
||||
end
|
||||
|
||||
def load_webhook_config(account)
|
||||
configs = account.encrypted_configs.find_by(key: EncryptedConfig::WEBHOOK_URL_KEY)
|
||||
|
||||
if !configs && !Docuseal.multitenant? && !account.testing?
|
||||
configs = Account.order(:id).first.encrypted_configs.find_by(key: EncryptedConfig::WEBHOOK_URL_KEY)
|
||||
end
|
||||
|
||||
configs
|
||||
end
|
||||
|
||||
def load_webhook_preferences(account)
|
||||
configs = account.account_configs.find_by(key: AccountConfig::WEBHOOK_PREFERENCES_KEY)
|
||||
|
||||
unless Docuseal.multitenant?
|
||||
configs ||= Account.order(:id).first.account_configs.find_by(key: AccountConfig::WEBHOOK_PREFERENCES_KEY)
|
||||
end
|
||||
|
||||
configs&.value.presence || {}
|
||||
end
|
||||
|
||||
def load_signing_pkcs(account)
|
||||
cert_data =
|
||||
if Docuseal.multitenant?
|
||||
|
||||
@@ -14,7 +14,10 @@ module Submitters
|
||||
unless submitter.submission_events.exists?(event_type: 'start_form')
|
||||
SubmissionEvents.create_with_tracking_data(submitter, 'start_form', request)
|
||||
|
||||
SendFormStartedWebhookRequestJob.perform_async({ 'submitter_id' => submitter.id })
|
||||
submitter.account.webhook_urls.with_event('form.started').each do |webhook_url|
|
||||
SendFormStartedWebhookRequestJob.perform_async({ 'submitter_id' => submitter.id,
|
||||
'webhook_url_id' => webhook_url.id })
|
||||
end
|
||||
end
|
||||
|
||||
update_submitter!(submitter, params, request)
|
||||
|
||||
Reference in New Issue
Block a user