X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c2af89c00e5bcb20981e737abb779ef65acd7b3e..b45642d2abca834c59e7db1fda512151393c88cc:/app/controllers/user_blocks_controller.rb diff --git a/app/controllers/user_blocks_controller.rb b/app/controllers/user_blocks_controller.rb index 058c442d5..63ebdad71 100644 --- a/app/controllers/user_blocks_controller.rb +++ b/app/controllers/user_blocks_controller.rb @@ -32,7 +32,7 @@ class UserBlocksController < ApplicationController end def edit - params[:user_block_period] = ((@user_block.ends_at - Time.now.getutc) / 1.hour).ceil.to_s + params[:user_block_period] = ((@user_block.ends_at - Time.now.utc) / 1.hour).ceil.to_s end def create @@ -41,7 +41,7 @@ class UserBlocksController < ApplicationController :user => @user, :creator => current_user, :reason => params[:user_block][:reason], - :ends_at => Time.now.getutc + @block_period.hours, + :ends_at => Time.now.utc + @block_period.hours, :needs_view => params[:user_block][:needs_view] ) @@ -62,7 +62,7 @@ class UserBlocksController < ApplicationController flash[:error] = t(".only_creator_can_edit") redirect_to :action => "edit" elsif @user_block.update( - :ends_at => Time.now.getutc + @block_period.hours, + :ends_at => Time.now.utc + @block_period.hours, :reason => params[:user_block][:reason], :needs_view => params[:user_block][:needs_view] ) @@ -79,7 +79,7 @@ class UserBlocksController < ApplicationController ## # revokes the block, setting the end_time to now def revoke - if params[:confirm] && @user_block.revoke!(current_user) + if request.post? && params[:confirm] && @user_block.revoke!(current_user) flash[:notice] = t ".flash" redirect_to(@user_block) end