* chore: exclude inbox_id from webhook update parameters * feat: display inbox label in webhook settings * feat: add inbox selection to webhook form * feat: prevent updating inbox_id in webhook update * feat: integrate MultiselectDropdown for inbox selection in webhook form * feat: add inbox matching logic to webhook event delivery * feat: remove unused inbox input placeholder from webhook form * fix: MultiselectDropdown component submiting form * feat: refine webhook parameters for create and update actions * feat: disable URL input field when editing webhook * chore: remove unnecessary parentheses * chore: update webhook controller spec to ignore inbox_id and url updates * fix: clean up JSON formatting * fix: standardize inbox_id to inboxId in WebhookForm component * refactor: replace LabelItem with InboxName component in WebhookRow * chore: enhance MultiselectDropdown with button variant prop and update styling in WebhookForm * chore: simplify MultiselectDropdown wrapper in WebhookForm component * chore: update selectedInbox initialization to null and reorder form fields * refactor: simplify InboxName * chore: add dark variant styling for buttons in SCSS * test: add inbox filtering for webhook event triggers in WebhookListener * test: refactor webhook controller spec to use a variable for URL and improve update expectations * feat(webhook): all inboxes option * chore: remove dark variant styling for buttons in SCSS * fix: bad interaction multiselectdropdown inside label * chore: invert if * chore: rename to assignedInbox and drop inboxId * refactor(WebhookForm): restore div separating fields from buttons * test: improve description --------- Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
37 lines
772 B
Ruby
37 lines
772 B
Ruby
class Api::V1::Accounts::WebhooksController < Api::V1::Accounts::BaseController
|
|
before_action :check_authorization
|
|
before_action :fetch_webhook, only: [:update, :destroy]
|
|
|
|
def index
|
|
@webhooks = Current.account.webhooks
|
|
end
|
|
|
|
def create
|
|
@webhook = Current.account.webhooks.new(webhook_create_params)
|
|
@webhook.save!
|
|
end
|
|
|
|
def update
|
|
@webhook.update!(webhook_update_params)
|
|
end
|
|
|
|
def destroy
|
|
@webhook.destroy!
|
|
head :ok
|
|
end
|
|
|
|
private
|
|
|
|
def webhook_create_params
|
|
params.require(:webhook).permit(:inbox_id, :name, :url, subscriptions: [])
|
|
end
|
|
|
|
def webhook_update_params
|
|
params.require(:webhook).permit(:name, subscriptions: [])
|
|
end
|
|
|
|
def fetch_webhook
|
|
@webhook = Current.account.webhooks.find(params[:id])
|
|
end
|
|
end
|