mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 03:27:52 +00:00
* Feature: Ability to switch between multiple accounts * Fix rubocop * Fix assigned inboxes * fix auth json * Add account switcher in UI * fix ordering on administrate * Add switch accounts to sidebar * add account id * Fix schema.rb timestamp * Revert "add account id" This reverts commit 27570f50ef584cb9a5f69454f43f630b318c8807. * Add a check for account Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
38 lines
702 B
Ruby
38 lines
702 B
Ruby
class Api::V1::Accounts::WebhooksController < Api::BaseController
|
|
before_action :current_account
|
|
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_params)
|
|
@webhook.save!
|
|
end
|
|
|
|
def update
|
|
@webhook.update!(webhook_params)
|
|
end
|
|
|
|
def destroy
|
|
@webhook.destroy
|
|
head :ok
|
|
end
|
|
|
|
private
|
|
|
|
def webhook_params
|
|
params.require(:webhook).permit(:inbox_id, :url)
|
|
end
|
|
|
|
def fetch_webhook
|
|
@webhook = current_account.webhooks.find(params[:id])
|
|
end
|
|
|
|
def check_authorization
|
|
authorize(Webhook)
|
|
end
|
|
end
|