adjust webhooks

This commit is contained in:
Pete Matsyburka committed 2024-11-03 09:49:30 +02:00
1 parent 84edb6dbda
commit 2542f26d96
40 files changed
+156 -235

No files matched your search

@@ -0,0 +1,22 @@
# frozen_string_literal: true
class WebhookPreferencesController < ApplicationController
load_and_authorize_resource :webhook_url, parent: false
def update
webhook_preferences_params[:events].each do |event, val|
@webhook_url.events.delete(event) if val == '0'
@webhook_url.events.push(event) if val == '1' && @webhook_url.events.exclude?(event)
end
@webhook_url.save!
head :ok
end
private
def webhook_preferences_params
params.require(:webhook_url).permit(events: {})
end
end