X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/735a5cf9e25b81d03db80ca4393aa34ea74d612a..2d7e0a397a1b2dbed74f40439c1305b1b48a063e:/app/controllers/api/notes_controller.rb diff --git a/app/controllers/api/notes_controller.rb b/app/controllers/api/notes_controller.rb index be36421d9..c141bdf46 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] ## @@ -385,7 +384,7 @@ module Api def add_comment(note, text, event, notify: true) attributes = { :visible => true, :event => event, :body => text } - if doorkeeper_token || current_token + if doorkeeper_token author = current_user if scope_enabled?(:write_notes) else author = current_user @@ -402,6 +401,8 @@ module Api note.comments.map(&:author).uniq.each do |user| UserMailer.note_comment_notification(comment, user).deliver_later if notify && user && user != current_user && user.visible? end + + NoteSubscription.find_or_create_by(:note => note, :user => current_user) if current_user end end end