Commit de0b84a8 authored by Peter Leitzen's avatar Peter Leitzen

Rename PublishIncidentService to PublishService

Also rename PublishIncidentWorker to PublishService
for consistency.
parent 57a36570
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
- 2 - 2
- - service_desk_email_receiver - - service_desk_email_receiver
- 1 - 1
- - status_page_publish_incident - - status_page_publish
- 1 - 1
- - sync_seat_link_request - - sync_seat_link_request
- 1 - 1
......
...@@ -4,9 +4,9 @@ module StatusPage ...@@ -4,9 +4,9 @@ module StatusPage
# Render an issue as incident details and publish them to CDN. # Render an issue as incident details and publish them to CDN.
# #
# This is an internal service which is part of # This is an internal service which is part of
# +StatusPage::PublishIncidentService+ and is not meant to be called directly. # +StatusPage::PublishService+ and is not meant to be called directly.
# #
# Consider calling +StatusPage::PublishIncidentService+ instead. # Consider calling +StatusPage::PublishService+ instead.
class PublishDetailsService < PublishBaseService class PublishDetailsService < PublishBaseService
private private
......
...@@ -4,9 +4,9 @@ module StatusPage ...@@ -4,9 +4,9 @@ module StatusPage
# Render a list of issues as incidents and publish them to CDN. # Render a list of issues as incidents and publish them to CDN.
# #
# This is an internal service which is part of # This is an internal service which is part of
# +StatusPage::PublishIncidentService+ and is not meant to be called directly. # +StatusPage::PublishService+ and is not meant to be called directly.
# #
# Consider calling +StatusPage::PublishIncidentService+ instead. # Consider calling +StatusPage::PublishService+ instead.
class PublishListService < PublishBaseService class PublishListService < PublishBaseService
private private
......
...@@ -11,7 +11,7 @@ module StatusPage ...@@ -11,7 +11,7 @@ module StatusPage
# * StatusPage::PublishDetailsService # * StatusPage::PublishDetailsService
# * StatusPage::UnpublishDetailsService # * StatusPage::UnpublishDetailsService
# * StatusPage::PublishListService # * StatusPage::PublishListService
class PublishIncidentService class PublishService
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
def initialize(user:, project:, issue_id:) def initialize(user:, project:, issue_id:)
......
...@@ -15,8 +15,7 @@ module StatusPage ...@@ -15,8 +15,7 @@ module StatusPage
return unless can_publish? return unless can_publish?
return unless status_page_enabled? return unless status_page_enabled?
StatusPage::PublishIncidentWorker StatusPage::PublishWorker.perform_async(user.id, project.id, issue_id)
.perform_async(user.id, project.id, issue_id)
end end
private private
......
...@@ -6,9 +6,9 @@ module StatusPage ...@@ -6,9 +6,9 @@ module StatusPage
# Example: An issue becomes confidential so it must be removed from CDN. # Example: An issue becomes confidential so it must be removed from CDN.
# #
# This is an internal service which is part of # This is an internal service which is part of
# +StatusPage::PublishIncidentService+ and is not meant to be called directly. # +StatusPage::PublishService+ and is not meant to be called directly.
# #
# Consider calling +StatusPage::PublishIncidentService+ instead. # Consider calling +StatusPage::PublishService+ instead.
class UnpublishDetailsService < PublishBaseService class UnpublishDetailsService < PublishBaseService
private private
......
...@@ -577,7 +577,7 @@ ...@@ -577,7 +577,7 @@
:resource_boundary: :unknown :resource_boundary: :unknown
:weight: 1 :weight: 1
:idempotent: :idempotent:
- :name: status_page_publish_incident - :name: status_page_publish
:feature_category: :status_page :feature_category: :status_page
:has_external_dependencies: true :has_external_dependencies: true
:urgency: :low :urgency: :low
......
# frozen_string_literal: true # frozen_string_literal: true
module StatusPage module StatusPage
class PublishIncidentWorker class PublishWorker
include ApplicationWorker include ApplicationWorker
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
...@@ -26,7 +26,7 @@ module StatusPage ...@@ -26,7 +26,7 @@ module StatusPage
attr_reader :user_id, :project_id, :issue_id attr_reader :user_id, :project_id, :issue_id
def publish def publish
result = PublishIncidentService result = PublishService
.new(user: user, project: project, issue_id: issue_id) .new(user: user, project: project, issue_id: issue_id)
.execute .execute
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe StatusPage::PublishIncidentService do describe StatusPage::PublishService do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be(:project, refind: true) { create(:project) } let_it_be(:project, refind: true) { create(:project) }
let_it_be(:issue) { create(:issue, project: project) } let_it_be(:issue) { create(:issue, project: project) }
......
...@@ -7,7 +7,7 @@ describe StatusPage::TriggerPublishService do ...@@ -7,7 +7,7 @@ describe StatusPage::TriggerPublishService do
let_it_be(:project, refind: true) { create(:project) } let_it_be(:project, refind: true) { create(:project) }
let_it_be(:issue) { create(:issue, project: project) } let_it_be(:issue) { create(:issue, project: project) }
let(:service) { described_class.new(user: user, project: project) } let(:service) { described_class.new(user: user, project: project) }
let(:worker) { StatusPage::PublishIncidentWorker } let(:worker) { StatusPage::PublishWorker }
let_it_be(:status_page_setting) do let_it_be(:status_page_setting) do
create(:status_page_setting, :enabled, project: project) create(:status_page_setting, :enabled, project: project)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe StatusPage::PublishIncidentWorker do describe StatusPage::PublishWorker do
include ExclusiveLeaseHelpers include ExclusiveLeaseHelpers
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
...@@ -11,11 +11,11 @@ describe StatusPage::PublishIncidentWorker do ...@@ -11,11 +11,11 @@ describe StatusPage::PublishIncidentWorker do
let(:worker) { described_class.new } let(:worker) { described_class.new }
let(:logger) { worker.send(:logger) } let(:logger) { worker.send(:logger) }
let(:service) { instance_double(StatusPage::PublishIncidentService) } let(:service) { instance_double(StatusPage::PublishService) }
let(:service_result) { ServiceResponse.success } let(:service_result) { ServiceResponse.success }
before do before do
allow(StatusPage::PublishIncidentService) allow(StatusPage::PublishService)
.to receive(:new).with(user: user, project: project, issue_id: issue.id) .to receive(:new).with(user: user, project: project, issue_id: issue.id)
.and_return(service) .and_return(service)
allow(service).to receive(:execute) allow(service).to receive(:execute)
...@@ -40,7 +40,7 @@ describe StatusPage::PublishIncidentWorker do ...@@ -40,7 +40,7 @@ describe StatusPage::PublishIncidentWorker do
let(:project) { build(:project) } let(:project) { build(:project) }
it 'does not execute the service' do it 'does not execute the service' do
expect(StatusPage::PublishIncidentService).not_to receive(:execute) expect(StatusPage::PublishService).not_to receive(:execute)
subject subject
end end
......
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