[openstreetmap/openstreetmap-website] Note subscriptions API (PR #5314)
Tom Hughes
notifications at github.com
Thu Nov 14 18:04:17 UTC 2024
@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/2436843040 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241114/653740a4/attachment-0001.htm>
More information about the rails-dev
mailing list