Commit 8de5f607 authored by John Hope's avatar John Hope

Remove project_only from Services, prevent view exception instead

This commit removes changes that created project_only services,
in favour of simply stopping the exception that occurs when
trying to set application-wide settings for generic alerts in
the Admin Area.
parent 2b38f71a
...@@ -7,7 +7,7 @@ class Admin::ServicesController < Admin::ApplicationController ...@@ -7,7 +7,7 @@ class Admin::ServicesController < Admin::ApplicationController
before_action :service, only: [:edit, :update] before_action :service, only: [:edit, :update]
def index def index
@services = services_templates.reject(&:project_only?) @services = services_templates
end end
def edit def edit
......
...@@ -330,11 +330,6 @@ class Service < ApplicationRecord ...@@ -330,11 +330,6 @@ class Service < ApplicationRecord
false false
end end
# Override for services supported at project level only
def project_only?
false
end
private private
def cache_project_has_external_issue_tracker def cache_project_has_external_issue_tracker
......
---
title: Exclude project-only services from the admin service templates area
merge_request: 20938
author:
type: fixed
...@@ -58,10 +58,6 @@ class AlertsService < Service ...@@ -58,10 +58,6 @@ class AlertsService < Service
super || build_data super || build_data
end end
def project_only?
true
end
private private
def prevent_token_assignment def prevent_token_assignment
......
- return unless @project.alerts_service_available? - return unless @project&.alerts_service_available?
.js-alerts-service-settings{ data: { activated: @service.activated?.to_s, .js-alerts-service-settings{ data: { activated: @service.activated?.to_s,
form_path: project_service_path(@project, @service.to_param), form_path: project_service_path(@project, @service.to_param),
......
...@@ -106,8 +106,4 @@ describe AlertsService do ...@@ -106,8 +106,4 @@ describe AlertsService do
it_behaves_like 'valid token' it_behaves_like 'valid token'
end end
end end
describe '#project_only?' do
it { expect(service).to be_project_only }
end
end end
...@@ -9,15 +9,6 @@ describe Admin::ServicesController do ...@@ -9,15 +9,6 @@ describe Admin::ServicesController do
sign_in(admin) sign_in(admin)
end end
describe 'GET #index' do
it 'does not show project_only services' do
get :index
expect(assigns(:services)).not_to include(be_project_only),
"expected to exclude project_only services"
end
end
describe 'GET #edit' do describe 'GET #edit' do
let!(:project) { create(:project) } let!(:project) { create(:project) }
......
...@@ -399,12 +399,6 @@ describe Service do ...@@ -399,12 +399,6 @@ describe Service do
end end
end end
describe '#project_only?' do
let(:service) { build_stubbed(:service, template: true) }
it { expect(service).not_to be_project_only }
end
describe '#api_field_names' do describe '#api_field_names' do
let(:fake_service) do let(:fake_service) do
Class.new(Service) do Class.new(Service) do
......
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