use webhook urls instead of encrypted configs
This commit is contained in:
committed by
Pete Matsyburka
parent
f669045362
commit
84edb6dbda
@@ -66,7 +66,7 @@ class TemplatesController < ApplicationController
|
||||
if @template.save
|
||||
Templates::CloneAttachments.call(template: @template, original_template: @base_template) if @base_template
|
||||
|
||||
SendTemplateUpdatedWebhookRequestJob.perform_async('template_id' => @template.id)
|
||||
enqueue_template_created_webhooks(@template)
|
||||
|
||||
maybe_redirect_to_template(@template)
|
||||
else
|
||||
@@ -77,7 +77,7 @@ class TemplatesController < ApplicationController
|
||||
def update
|
||||
@template.update!(template_params)
|
||||
|
||||
SendTemplateUpdatedWebhookRequestJob.perform_async('template_id' => @template.id)
|
||||
enqueue_template_updated_webhooks(@template)
|
||||
|
||||
head :ok
|
||||
end
|
||||
@@ -128,6 +128,20 @@ class TemplatesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def enqueue_template_created_webhooks(template)
|
||||
template.account.webhook_urls.with_event('template.updated').each do |webhook_url|
|
||||
SendTemplateCreatedWebhookRequestJob.perform_async({ 'template_id' => template.id,
|
||||
'webhook_url_id' => webhook_url.id })
|
||||
end
|
||||
end
|
||||
|
||||
def enqueue_template_updated_webhooks(template)
|
||||
template.account.webhook_urls.with_event('template.updated').each do |webhook_url|
|
||||
SendTemplateUpdatedWebhookRequestJob.perform_async({ 'template_id' => template.id,
|
||||
'webhook_url_id' => webhook_url.id })
|
||||
end
|
||||
end
|
||||
|
||||
def load_base_template
|
||||
return if params[:base_template_id].blank?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user