[openstreetmap/openstreetmap-website] Note subscriptions API (PR #5314)

Anton Khorev notifications at github.com
Thu Nov 14 09:35:00 UTC 2024


@AntonKhorev 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

`conflict` is what changeset subscribe does in this case, I'm doing the same here

https://wiki.openstreetmap.org/wiki/API_v0.6#Subscribe:_POST_/api/0.6/changeset/#id/subscribe

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

Message ID: <openstreetmap/openstreetmap-website/pull/5314/review/2435514872 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241114/cb44e9c1/attachment.htm>


More information about the rails-dev mailing list