From 2fadbf81bc209669d7079ed076a745c209ae3db3 Mon Sep 17 00:00:00 2001 From: Muhsin <12408980+muhsin-k@users.noreply.github.com> Date: Wed, 3 Jun 2026 15:16:06 +0400 Subject: [PATCH] fix(app-store): simplify inbox creation controller --- .../api/v1/accounts/inboxes_controller.rb | 10 ---------- .../api/v1/accounts/inboxes_controller_spec.rb | 12 ------------ 2 files changed, 22 deletions(-) diff --git a/app/controllers/api/v1/accounts/inboxes_controller.rb b/app/controllers/api/v1/accounts/inboxes_controller.rb index 7d93af25a..9b8f7b747 100644 --- a/app/controllers/api/v1/accounts/inboxes_controller.rb +++ b/app/controllers/api/v1/accounts/inboxes_controller.rb @@ -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 diff --git a/spec/controllers/api/v1/accounts/inboxes_controller_spec.rb b/spec/controllers/api/v1/accounts/inboxes_controller_spec.rb index ed5871be9..4959c1e45 100644 --- a/spec/controllers/api/v1/accounts/inboxes_controller_spec.rb +++ b/spec/controllers/api/v1/accounts/inboxes_controller_spec.rb @@ -434,18 +434,6 @@ RSpec.describe 'Inboxes API', type: :request do expect(response.body).to include('+123456789') end - it 'does not create an app store inbox when the feature is disabled' do - post "/api/v1/accounts/#{account.id}/inboxes", - headers: admin.create_new_auth_token, - params: { name: 'App Store Reviews', - channel: { type: 'app_store', app_id: '123456789', issuer_id: SecureRandom.uuid, key_id: 'KEY123', - private_key: OpenSSL::PKey::EC.generate('prime256v1').to_pem } }, - as: :json - - expect(response).to have_http_status(:forbidden) - expect(response.parsed_body['message']).to eq('App Store Reviews channel is not enabled for this account') - end - it 'creates an app store inbox when the feature is enabled' do app_store_client = instance_double(AppStoreConnect::Client)