]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/notes_controller.rb
Update to rails 7.2.2.1
[rails.git] / app / controllers / api / notes_controller.rb
index 9a00814f502d48d4c0df921458897a7a05a1dd4b..7e2e7fb793babed86952313cc1d0703043d2f760 100644 (file)
@@ -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