X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/dbc3ab53e76f74306b2fe9722e5e77b52a45cf06..84ff3ed43acb29f332b2811b887007981a055e35:/app/controllers/api/notes_controller.rb?ds=inline diff --git a/app/controllers/api/notes_controller.rb b/app/controllers/api/notes_controller.rb index 3352c1f69..7e2e7fb79 100644 --- a/app/controllers/api/notes_controller.rb +++ b/app/controllers/api/notes_controller.rb @@ -7,7 +7,6 @@ module Api authorize_resource before_action :set_locale - around_action :api_call_handle_error, :api_call_timeout before_action :set_request_formats, :except => [:feed] ## @@ -399,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