<%= attrs[:name] %>
+<%= attrs[:name] %>
+ <% if attrs[:enterprise] %> + EE + <% end %> + <% if attrs[:config_key].present? && attrs[:enabled] %> + + + + <% end %> +<%= attrs[:description] %>
diff --git a/enterprise/app/controllers/enterprise/super_admin/app_configs_controller.rb b/enterprise/app/controllers/enterprise/super_admin/app_configs_controller.rb new file mode 100644 index 000000000000..c8a42e391c8c --- /dev/null +++ b/enterprise/app/controllers/enterprise/super_admin/app_configs_controller.rb @@ -0,0 +1,23 @@ +module Enterprise::SuperAdmin::AppConfigsController + private + + def allowed_configs + return super if ChatwootHub.pricing_plan == 'community' + + case @config + when 'custom_branding' + @allowed_configs = %w[ + LOGO_THUMBNAIL + LOGO + BRAND_NAME + INSTALLATION_NAME + BRAND_URL + WIDGET_BRAND_URL + TERMS_URL + PRIVACY_URL + ] + else + super + end + end +end diff --git a/enterprise/app/helpers/super_admin/features.yml b/enterprise/app/helpers/super_admin/features.yml index dd7b556fbf95..41e5af426671 100644 --- a/enterprise/app/helpers/super_admin/features.yml +++ b/enterprise/app/helpers/super_admin/features.yml @@ -3,21 +3,26 @@ custom_branding: description: 'Apply your own branding to this installation.' enabled: <%= (ChatwootHub.pricing_plan != 'community') %> icon: 'icon-paint-brush-line' + config_key: 'custom_branding' + enterprise: true agent_capacity: name: 'Agent Capacity' description: 'Set limits to auto-assigning conversations to your agents.' enabled: <%= (ChatwootHub.pricing_plan != 'community') %> icon: 'icon-hourglass-line' + enterprise: true audit_logs: name: 'Audit Logs' description: 'Track and trace account activities with ease with detailed audit logs.' enabled: <%= (ChatwootHub.pricing_plan != 'community') %> icon: 'icon-menu-search-line' + enterprise: true disable_branding: name: 'Disable Branding' description: 'Disable branding on live-chat widget and external emails.' enabled: <%= (ChatwootHub.pricing_plan != 'community') %> icon: 'icon-sailbot-fill' + enterprise: true live_chat: name: 'Live Chat' description: 'Improve your customer experience using a live chat on your website.' @@ -33,6 +38,7 @@ messenger: description: 'Stay connected with your customers on Facebook & Instagram.' enabled: true icon: 'icon-messenger-line' + config_key: 'facebook' whatsapp: name: 'WhatsApp' description: 'Manage your WhatsApp business interactions from Chatwoot.' diff --git a/spec/controllers/super_admin/app_config_controller_spec.rb b/spec/controllers/super_admin/app_config_controller_spec.rb index 3d6df46a8b72..338c3e611325 100644 --- a/spec/controllers/super_admin/app_config_controller_spec.rb +++ b/spec/controllers/super_admin/app_config_controller_spec.rb @@ -34,13 +34,13 @@ context 'when it is an aunthenticated super admin' do it 'shows the app_config page' do sign_in(super_admin, scope: :super_admin) - post '/super_admin/app_config', params: { app_config: { TESTKEY: 'TESTVALUE' } } + post '/super_admin/app_config', params: { app_config: { FB_APP_ID: 'FB_APP_ID' } } expect(response).to have_http_status(:found) - expect(response).to redirect_to(super_admin_app_config_path) + expect(response).to redirect_to(super_admin_settings_path) - config = GlobalConfig.get('TESTKEY') - expect(config['TESTKEY']).to eq('TESTVALUE') + config = GlobalConfig.get('FB_APP_ID') + expect(config['FB_APP_ID']).to eq('FB_APP_ID') end end end