You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docuseal/app/controllers/webhook_preferences_control...

23 lines
527 B

# 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