[openstreetmap/openstreetmap-website] Add user block api call (PR #4301)

Anton Khorev notifications at github.com
Sun Oct 27 22:46:16 UTC 2024


@AntonKhorev commented on this pull request.



> @@ -12,5 +15,33 @@ 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 should be a number of hours" unless period

Block durations are not stored directly. Dropdowns show the closes value to the remaining time: https://github.com/openstreetmap/openstreetmap-website/pull/5011

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

Message ID: <openstreetmap/openstreetmap-website/pull/4301/review/2397643489 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241027/2373802e/attachment.htm>


More information about the rails-dev mailing list