@tomhughes commented on this pull request.


> @@ -0,0 +1,22 @@
+module Api
+  class NoteSubscriptionsController < ApiController
+    before_action :check_api_writable
+    before_action :authorize
+
+    authorize_resource
+
+    def create
+      note_id = params[:note_id].to_i
+      note = Note.find(note_id)
+      note.subscribers << current_user
+    rescue ActiveRecord::RecordNotUnique
+      head :conflict

OK but that does raise a custom error that includes a nice message explaining 
the problem - should we do that here? and for the not found case on 
unsubscription.

I'm not really sure why changesets do it by throwing an exception - a custom 
message could be just as easily returned inline.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5314#discussion_r1842675557
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/5314/review/2436843...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to