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

build_service.rb « notification_recipients « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0fe0d26d7b28425bfacbd21bdc2da43c24709fff (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
33
34
35
36
37
38
39
40
# frozen_string_literal: true

#
# Used by NotificationService to determine who should receive notification
#
module NotificationRecipients
  module BuildService
    def self.notifiable_users(users, *args)
      users.compact.map { |u| NotificationRecipient.new(u, *args) }.select(&:notifiable?).map(&:user)
    end

    def self.notifiable?(user, *args)
      NotificationRecipient.new(user, *args).notifiable?
    end

    def self.build_recipients(*args)
      ::NotificationRecipients::Builder::Default.new(*args).notification_recipients
    end

    def self.build_new_note_recipients(*args)
      ::NotificationRecipients::Builder::NewNote.new(*args).notification_recipients
    end

    def self.build_merge_request_unmergeable_recipients(*args)
      ::NotificationRecipients::Builder::MergeRequestUnmergeable.new(*args).notification_recipients
    end

    def self.build_project_maintainers_recipients(*args)
      ::NotificationRecipients::Builder::ProjectMaintainers.new(*args).notification_recipients
    end

    def self.build_new_release_recipients(*args)
      ::NotificationRecipients::Builder::NewRelease.new(*args).notification_recipients
    end

    def self.build_new_review_recipients(*args)
      ::NotificationRecipients::Builder::NewReview.new(*args).notification_recipients
    end
  end
end