summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/services/notification_recipient_service.rb19
-rw-r--r--app/services/notification_service.rb8
2 files changed, 7 insertions, 20 deletions
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb
index 7d4f8110f84..8c7a36d4cb0 100644
--- a/app/services/notification_recipient_service.rb
+++ b/app/services/notification_recipient_service.rb
@@ -14,10 +14,6 @@ module NotificationRecipientService
Builder::Default.new(*a).recipient_users
end
- def self.build_relabeled_recipients(*a)
- Builder::Relabeled.new(*a).recipient_users
- end
-
def self.build_new_note_recipients(*a)
Builder::NewNote.new(*a).recipient_users
end
@@ -246,21 +242,6 @@ module NotificationRecipientService
end
end
- class Relabeled < Base
- attr_reader :target
- attr_reader :current_user
- attr_reader :labels
- def initialize(target, current_user, labels:)
- @target = target
- @current_user = current_user
- @labels = labels
- end
-
- def build!
- add_labels_subscribers(labels: labels)
- end
- end
-
class NewNote < Base
attr_reader :note
def initialize(note)
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 2e52296f048..a62085dffd4 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -368,7 +368,13 @@ class NotificationService
end
def relabeled_resource_email(target, labels, current_user, method)
- recipients = NotificationRecipientService.build_relabeled_recipients(target, current_user, labels: labels)
+ recipients = labels.flat_map { |l| l.subscribers(target.project) }
+ recipients = NotificationRecipientService.notifiable_users(
+ recipients, :subscription,
+ target: target,
+ acting_user: current_user,
+ )
+
label_names = labels.map(&:name)
recipients.each do |recipient|