debian-mirror-gitlab/app/models/project_services/alerts_service.rb

29 lines
852 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
2021-03-08 18:12:59 +05:30
# This service is scheduled for removal. All records must
# be deleted before the class can be removed.
# https://gitlab.com/groups/gitlab-org/-/epics/5056
2020-03-13 15:44:24 +05:30
class AlertsService < Service
2021-03-08 18:12:59 +05:30
before_save :prevent_save
2020-03-13 15:44:24 +05:30
def self.to_param
'alerts'
end
def self.supported_events
%w()
end
private
2021-03-08 18:12:59 +05:30
def prevent_save
errors.add(:base, _('Alerts endpoint is deprecated and should not be created or modified. Use HTTP Integrations instead.'))
log_error('Prevented attempt to save or update deprecated AlertsService')
2021-01-29 00:20:46 +05:30
2021-03-08 18:12:59 +05:30
# Stops execution of callbacks and database operation while
# preserving expectations of #save (will not raise) & #save! (raises)
# https://guides.rubyonrails.org/active_record_callbacks.html#halting-execution
throw :abort # rubocop:disable Cop/BanCatchThrow
2021-01-29 00:20:46 +05:30
end
2020-03-13 15:44:24 +05:30
end