Commit a5cea27a authored by Justin Ho's avatar Justin Ho

Move logic to helper method

parent 4b49e8b9
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
class Admin::ApplicationSettingsController < Admin::ApplicationController class Admin::ApplicationSettingsController < Admin::ApplicationController
include InternalRedirect include InternalRedirect
include ServicesHelper
# NOTE: Use @application_setting in this controller when you need to access # NOTE: Use @application_setting in this controller when you need to access
# application_settings after it has been modified. This is because the # application_settings after it has been modified. This is because the
...@@ -32,7 +33,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -32,7 +33,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end end
def integrations def integrations
return not_found if Gitlab.com? return not_found unless instance_level_integrations?
@integrations = Service.find_or_initialize_all(Service.for_instance).sort_by(&:title) @integrations = Service.find_or_initialize_all(Service.for_instance).sort_by(&:title)
end end
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
class Admin::IntegrationsController < Admin::ApplicationController class Admin::IntegrationsController < Admin::ApplicationController
include IntegrationsActions include IntegrationsActions
include ServicesHelper
private private
...@@ -10,7 +11,7 @@ class Admin::IntegrationsController < Admin::ApplicationController ...@@ -10,7 +11,7 @@ class Admin::IntegrationsController < Admin::ApplicationController
end end
def integrations_enabled? def integrations_enabled?
!Gitlab.com? instance_level_integrations?
end end
def scoped_edit_integration_path(integration) def scoped_edit_integration_path(integration)
......
...@@ -124,6 +124,10 @@ module ServicesHelper ...@@ -124,6 +124,10 @@ module ServicesHelper
@group.present? && Feature.enabled?(:group_level_integrations, @group) @group.present? && Feature.enabled?(:group_level_integrations, @group)
end end
def instance_level_integrations?
!Gitlab.com?
end
extend self extend self
private private
......
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
= link_to general_admin_application_settings_path, title: _('General'), class: 'qa-admin-settings-general-item' do = link_to general_admin_application_settings_path, title: _('General'), class: 'qa-admin-settings-general-item' do
%span %span
= _('General') = _('General')
- unless Gitlab.com? - if instance_level_integrations?
= nav_link(path: ['application_settings#integrations', 'integrations#edit']) do = nav_link(path: ['application_settings#integrations', 'integrations#edit']) do
= link_to integrations_admin_application_settings_path, title: _('Integrations'), data: { qa_selector: 'integration_settings_link' } do = link_to integrations_admin_application_settings_path, title: _('Integrations'), data: { qa_selector: 'integration_settings_link' } do
%span %span
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment