debian-mirror-gitlab/app/services/notification_recipients/build_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.3 KiB
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# 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
2021-01-03 14:25:43 +05:30
def self.build_recipients(target, current_user, **args)
::NotificationRecipients::Builder::Default.new(target, current_user, **args).notification_recipients
2020-04-08 14:13:33 +05:30
end
2023-04-23 21:23:45 +05:30
def self.build_new_note_recipients(...)
::NotificationRecipients::Builder::NewNote.new(...).notification_recipients
2020-04-08 14:13:33 +05:30
end
2023-04-23 21:23:45 +05:30
def self.build_merge_request_unmergeable_recipients(...)
::NotificationRecipients::Builder::MergeRequestUnmergeable.new(...).notification_recipients
2020-04-08 14:13:33 +05:30
end
2021-01-03 14:25:43 +05:30
def self.build_project_maintainers_recipients(target, **args)
::NotificationRecipients::Builder::ProjectMaintainers.new(target, **args).notification_recipients
2020-04-08 14:13:33 +05:30
end
2023-04-23 21:23:45 +05:30
def self.build_new_review_recipients(...)
::NotificationRecipients::Builder::NewReview.new(...).notification_recipients
2020-06-23 00:09:42 +05:30
end
2021-03-11 19:13:27 +05:30
2023-04-23 21:23:45 +05:30
def self.build_requested_review_recipients(...)
::NotificationRecipients::Builder::RequestReview.new(...).notification_recipients
2021-03-11 19:13:27 +05:30
end
2020-04-08 14:13:33 +05:30
end
end