]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/changeset_comments_controller.rb
Standardise on avoiding except lists for check_api_readable
[rails.git] / app / controllers / api / changeset_comments_controller.rb
index 756e56dccdfb706d8d6e7c4456683fcc232eb08c..c1980e80b38159dfe3e96b3cd769491b952544c4 100644 (file)
@@ -1,7 +1,7 @@
 module Api
   class ChangesetCommentsController < ApiController
+    before_action :check_api_readable
     before_action :check_api_writable
-    before_action :check_api_readable, :except => [:create]
     before_action :authorize
 
     authorize_resource
@@ -105,7 +105,7 @@ module Api
     ##
     # Check if the current user has exceed the rate limit for comments
     def rate_limit_exceeded?
-      recent_comments = current_user.changeset_comments.where("created_at >= ?", Time.now.utc - 1.hour).count
+      recent_comments = current_user.changeset_comments.where(:created_at => Time.now.utc - 1.hour..).count
 
       recent_comments >= current_user.max_changeset_comments_per_hour
     end