[openstreetmap/openstreetmap-website] Add user block api call (PR #4301)
Anton Khorev
notifications at github.com
Sat Oct 21 16:01:13 UTC 2023
@AntonKhorev 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]
+ raise OSM::APIBadUserInput, "No period was given" unless params[:period]
+
+ period = Integer(params[:period], :exception => false)
+ raise OSM::APIBadUserInput, "Period one is in a wrong format" unless period
I was copying the structure of error messages from other controllers where you can find "Date #{params[:from]} is in a wrong format".
Changed to "Period should be a number of hours".
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4301#discussion_r1367751934
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4301/review/1691282026 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231021/c0918f33/attachment.htm>
More information about the rails-dev
mailing list