]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/notes_controller.rb
Subscribe users when they interact with notes
[rails.git] / app / controllers / api / notes_controller.rb
index 9a00814f502d48d4c0df921458897a7a05a1dd4b..c141bdf46a08146047c7c68f6f6673886202f5db 100644 (file)
@@ -401,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
       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
     end
   end
 end