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
before_action :service, only: [:edit, :update]
def index
@services = services_templates.reject(&:project_only?)
@services = services_templates
end
def edit
......
......@@ -330,11 +330,6 @@ class Service < ApplicationRecord
false
end
# Override for services supported at project level only
def project_only?
false
end
private
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
super || build_data
end
def project_only?
true
end
private
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,
form_path: project_service_path(@project, @service.to_param),
......
......@@ -106,8 +106,4 @@ describe AlertsService do
it_behaves_like 'valid token'
end
end
describe '#project_only?' do
it { expect(service).to be_project_only }
end
end
......@@ -9,15 +9,6 @@ describe Admin::ServicesController do
sign_in(admin)
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
let!(:project) { create(:project) }
......
......@@ -399,12 +399,6 @@ describe Service do
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
let(:fake_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