summaryrefslogtreecommitdiff
path: root/app/models/project_services/hipchat_service.rb
blob: 71d8e7bfac4539f6cf544d667a0bba79a10dc1ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

# This service is scheduled for removal. All records must
# be deleted before the class can be removed.
# https://gitlab.com/gitlab-org/gitlab/-/issues/27954
class HipchatService < Integration
  before_save :prevent_save

  def self.to_param
    'hipchat'
  end

  def self.supported_events
    []
  end

  def execute(data)
    # We removed the hipchat gem due to https://gitlab.com/gitlab-org/gitlab/-/issues/325851#note_537143149
    # HipChat is unusable anyway, so do nothing in this method
  end

  private

  def prevent_save
    errors.add(:base, _('HipChat endpoint is deprecated and should not be created or modified.'))

    # 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
  end
end