Welcome to mirror list, hosted at ThFree Co, Russian Federation.

alert_reference_filter.rb « filter « banzai « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 228a4159c99fc7f9f9b3dbd89ed34adc6ffb2bb8 (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
# frozen_string_literal: true

module Banzai
  module Filter
    class AlertReferenceFilter < IssuableReferenceFilter
      self.reference_type = :alert

      def self.object_class
        AlertManagement::Alert
      end

      def self.object_sym
        :alert
      end

      def parent_records(parent, ids)
        parent.alert_management_alerts.where(iid: ids.to_a)
      end

      def url_for_object(alert, project)
        ::Gitlab::Routing.url_helpers.details_project_alert_management_url(
          project,
          alert.iid,
          only_path: context[:only_path]
        )
      end
    end
  end
end