[openstreetmap/openstreetmap-website] Add user block api call (PR #4301)
mmd
notifications at github.com
Sat Oct 21 08:49:15 UTC 2023
@mmd-osm commented on this pull request.
> @@ -14,5 +16,30 @@ def show
rescue ActiveRecord::RecordNotFound
raise OSM::APINotFoundError
end
+
+ def create
+ raise OSM::APIBadUserInput, "No user was given" unless params[:user]
+
+ user = User.visible.find_by(:id => params[:user])
+ raise OSM::APINotFoundError unless user
+ raise OSM::APIBadUserInput, "No reason was given" unless params[:reason]
side note: "Reason" doesn't seem to have a max size check in the model. Maybe it would be good to introduce an upper limit, like 10'000 chars or something similar.
Regarding the reason_format, we're assuming the default "markdown", and don't want to give API users a choice here, right?
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4301#pullrequestreview-1691217016
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4301/review/1691217016 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231021/c99a82b9/attachment.htm>
More information about the rails-dev
mailing list