Commit 8afb27b4 authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch...

Merge branch '298854-gitlab-returns-error-500-when-visiting-admin-area-settings-integrations-mattermost-slash' into 'master'

Hide project-specific views on group / instance level integrations

See merge request gitlab-org/gitlab!57381
parents a853e5ad 7b8a8169
...@@ -413,6 +413,10 @@ class Service < ApplicationRecord ...@@ -413,6 +413,10 @@ class Service < ApplicationRecord
!instance? && !group_id !instance? && !group_id
end end
def project_level?
project_id.present?
end
def parent def parent
project || group project || group
end end
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
%p.inline %p.inline
= s_("MattermostService|See list of available commands in Mattermost after setting up this service, by entering") = s_("MattermostService|See list of available commands in Mattermost after setting up this service, by entering")
%kbd.inline /&lt;trigger&gt; help %kbd.inline /&lt;trigger&gt; help
- unless enabled || @service.template? - if !enabled && @service.project_level?
= render 'projects/services/mattermost_slash_commands/detailed_help', subject: @service = render 'projects/services/mattermost_slash_commands/detailed_help', subject: @service
- if enabled && !@service.template? - if enabled && @service.project_level?
= render 'projects/services/mattermost_slash_commands/installation_info', subject: @service = render 'projects/services/mattermost_slash_commands/installation_info', subject: @service
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
%p.inline %p.inline
= s_("SlackService|See list of available commands in Slack after setting up this service, by entering") = s_("SlackService|See list of available commands in Slack after setting up this service, by entering")
%kbd.inline /&lt;command&gt; help %kbd.inline /&lt;command&gt; help
- unless @service.template? - if @service.project_level?
%p= _("To set up this service:") %p= _("To set up this service:")
%ul.list-unstyled.indent-list %ul.list-unstyled.indent-list
%li %li
......
---
title: Hide project-specific views on group / instance level integrations
merge_request: 57381
author:
type: fixed
...@@ -6,5 +6,5 @@ ...@@ -6,5 +6,5 @@
%p.inline %p.inline
= _("See the list of available commands in Slack after setting up this service by entering") = _("See the list of available commands in Slack after setting up this service by entering")
%kbd.inline /gitlab help %kbd.inline /gitlab help
- unless @service.template? || @service.instance? - if @service.project_level?
= render "projects/services/#{@service.to_param}/slack_integration_form" = render "projects/services/#{@service.to_param}/slack_integration_form"
...@@ -202,6 +202,16 @@ RSpec.describe Service do ...@@ -202,6 +202,16 @@ RSpec.describe Service do
end end
end end
describe '#project_level?' do
it 'is true when service has a project' do
expect(build(:service, project: project)).to be_project_level
end
it 'is false when service has no project' do
expect(build(:service, project: nil)).not_to be_project_level
end
end
describe '.find_or_initialize_non_project_specific_integration' do describe '.find_or_initialize_non_project_specific_integration' do
let!(:service1) { create(:jira_service, project_id: nil, group_id: group.id) } let!(:service1) { create(:jira_service, project_id: nil, group_id: group.id) }
let!(:service2) { create(:jira_service) } let!(:service2) { create(:jira_service) }
......
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