mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 03:27:52 +00:00
22 lines
572 B
Ruby
22 lines
572 B
Ruby
class Api::V1::Accounts::ContactInboxesController < Api::V1::Accounts::BaseController
|
|
before_action :ensure_inbox
|
|
|
|
def filter
|
|
contact_inbox = @inbox.contact_inboxes.where(inbox_id: permitted_params[:inbox_id], source_id: permitted_params[:source_id])
|
|
return head :not_found if contact_inbox.empty?
|
|
|
|
@contact = contact_inbox.first.contact
|
|
end
|
|
|
|
private
|
|
|
|
def ensure_inbox
|
|
@inbox = Current.account.inboxes.find(permitted_params[:inbox_id])
|
|
authorize @inbox, :show?
|
|
end
|
|
|
|
def permitted_params
|
|
params.permit(:inbox_id, :source_id)
|
|
end
|
|
end
|