Commit 15085392 authored by Andy Soiron's avatar Andy Soiron Committed by Douglas Barbosa Alexandre

Show unpersisted services not active

Services are sometimes build from a template.
If the template is active, the service
will also show up as active even though
it is not really active until it is
persisted.
parent 074ff58f
......@@ -81,6 +81,10 @@ class Service < ApplicationRecord
active
end
def operating?
active && persisted?
end
def show_active_box?
true
end
......
......@@ -3,7 +3,7 @@
%h4.prepend-top-0
= @service.title
- [true, false].each do |value|
- hide_class = 'd-none' if @service.activated? != value
- hide_class = 'd-none' if @service.operating? != value
%span.js-service-active-status{ class: hide_class, data: { value: value.to_s } }
= boolean_to_icon value
......
......@@ -16,7 +16,7 @@
- activated_label = (integration.activated? ? s_("ProjectService|%{service_title}: status on") : s_("ProjectService|%{service_title}: status off")) % { service_title: integration.title }
%tr{ role: 'row' }
%td{ role: 'cell', 'aria-colindex': 1, 'aria-label': activated_label }
= boolean_to_icon integration.activated?
= boolean_to_icon integration.operating?
%td{ role: 'cell', 'aria-colindex': 2 }
= link_to scoped_edit_integration_path(integration), { data: { qa_selector: "#{integration.to_param}_link" } } do
%strong= integration.title
......
---
title: Fix bug when services appear active even though they are not
merge_request: 30160
author:
type: fixed
......@@ -87,6 +87,20 @@ describe Service do
end
end
describe '#operating?' do
it 'is false when the service is not active' do
expect(build(:service).operating?).to eq(false)
end
it 'is false when the service is not persisted' do
expect(build(:service, active: true).operating?).to eq(false)
end
it 'is true when the service is active and persisted' do
expect(create(:service, active: true).operating?).to eq(true)
end
end
describe '.confidential_note_hooks' do
it 'includes services where confidential_note_events is true' do
create(:service, active: true, confidential_note_events: true)
......
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