]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/notes_controller.rb
Merge remote-tracking branch 'upstream/pull/5376'
[rails.git] / app / controllers / api / notes_controller.rb
index c141bdf46a08146047c7c68f6f6673886202f5db..7e2e7fb793babed86952313cc1d0703043d2f760 100644 (file)
@@ -398,8 +398,10 @@ module Api
 
       comment = note.comments.create!(attributes)
 
 
       comment = note.comments.create!(attributes)
 
-      note.comments.map(&:author).uniq.each do |user|
-        UserMailer.note_comment_notification(comment, user).deliver_later if notify && user && user != current_user && user.visible?
+      if notify
+        note.subscribers.visible.each do |user|
+          UserMailer.note_comment_notification(comment, user).deliver_later if current_user != user
+        end
       end
 
       NoteSubscription.find_or_create_by(:note => note, :user => current_user) if current_user
       end
 
       NoteSubscription.find_or_create_by(:note => note, :user => current_user) if current_user