summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2017-08-02 14:16:00 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2017-08-03 09:07:18 -0700
commit273cd9c3c9d94e1d40249073ec23e4eba820f260 (patch)
tree98921ccfd0c05af9b06842992960bd7c6208bef7
parenteaa503d679e3c2a1396091efebda49a91637cb02 (diff)
downloadgitlab-ce-273cd9c3c9d94e1d40249073ec23e4eba820f260.tar.gz
remove build_relabeled_recipients
-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|