Module: Ci::PipelineScheduleOwnershipValidator

Extended by:
ActiveSupport::Concern
Included in:
Member, User
Defined in:
app/models/concerns/ci/pipeline_schedule_ownership_validator.rb

Instance Method Summary collapse

Instance Method Details

#notify_and_disable_all_pipeline_schedules_for_user(user_id) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/concerns/ci/pipeline_schedule_ownership_validator.rb', line 7

def notify_and_disable_all_pipeline_schedules_for_user(user_id)
  schedules = Ci::PipelineSchedule.active.owned_by(user_id)

  schedules.find_each do |schedule|
    notification_service.pipeline_schedule_owner_unavailable(schedule)
  end

  schedules.each_batch do |batch|
    batch.update_all(active: false)
  end
end