fix(app-store): simplify inbox creation controller
This commit is contained in:
@@ -31,8 +31,6 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
|
||||
end
|
||||
|
||||
def create
|
||||
return render_app_store_feature_disabled if app_store_channel_requested? && !Current.account.feature_enabled?(:channel_app_store)
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
channel = create_channel
|
||||
@inbox = Current.account.inboxes.build(
|
||||
@@ -102,14 +100,6 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
|
||||
%w[web_widget api email line telegram whatsapp sms app_store]
|
||||
end
|
||||
|
||||
def app_store_channel_requested?
|
||||
permitted_params.dig(:channel, :type) == 'app_store'
|
||||
end
|
||||
|
||||
def render_app_store_feature_disabled
|
||||
render json: { message: 'App Store Reviews channel is not enabled for this account' }, status: :forbidden
|
||||
end
|
||||
|
||||
def update_inbox_working_hours
|
||||
@inbox.update_working_hours(params.permit(working_hours: Inbox::OFFISABLE_ATTRS)[:working_hours]) if params[:working_hours]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user