Commit 55bc8d11 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch '348958-sy-shifts-read-service' into 'master'

Prefer OncallShifts::ReadService to inherit from BaseProjectService

See merge request gitlab-org/gitlab!82356
parents c482e870 131cdf41
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module IncidentManagement module IncidentManagement
module OncallShifts module OncallShifts
class ReadService class ReadService < ::BaseProjectService
MAXIMUM_TIMEFRAME = 1.month MAXIMUM_TIMEFRAME = 1.month
# @param rotation [IncidentManagement::OncallRotation] # @param rotation [IncidentManagement::OncallRotation]
...@@ -11,8 +11,9 @@ module IncidentManagement ...@@ -11,8 +11,9 @@ module IncidentManagement
# @option params - start_time [Time] # @option params - start_time [Time]
# @option params - end_time [Time] # @option params - end_time [Time]
def initialize(rotation, current_user, start_time:, end_time:) def initialize(rotation, current_user, start_time:, end_time:)
super(project: rotation.project, current_user: current_user)
@rotation = rotation @rotation = rotation
@current_user = current_user
@start_time = start_time @start_time = start_time
@end_time = end_time @end_time = end_time
@current_time = Time.current @current_time = Time.current
...@@ -33,7 +34,7 @@ module IncidentManagement ...@@ -33,7 +34,7 @@ module IncidentManagement
private private
attr_reader :rotation, :current_user, :start_time, :end_time, :current_time attr_reader :rotation, :start_time, :end_time, :current_time
def find_shifts def find_shifts
rotation rotation
...@@ -62,7 +63,7 @@ module IncidentManagement ...@@ -62,7 +63,7 @@ module IncidentManagement
end end
def available? def available?
::Gitlab::IncidentManagement.oncall_schedules_available?(rotation.project) ::Gitlab::IncidentManagement.oncall_schedules_available?(project)
end end
def allowed? def allowed?
......
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