X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ad2e50fcfb7aab6cb6bbf5518920e4091be5b9a4..a64b7237ec06264d26385e1384c3130bcbccd446:/app/controllers/api/notes_controller.rb?ds=sidebyside diff --git a/app/controllers/api/notes_controller.rb b/app/controllers/api/notes_controller.rb index 9a00814f5..7e2e7fb79 100644 --- a/app/controllers/api/notes_controller.rb +++ b/app/controllers/api/notes_controller.rb @@ -398,9 +398,13 @@ module Api 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 end end