]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_blocks_controller.rb
Add :closed trait to note factory
[rails.git] / app / controllers / user_blocks_controller.rb
index 63ebdad713b85f5b54785c5d8169a611f89d57dc..885318cbe10ef282762f47939465858767b1e73b 100644 (file)
@@ -1,4 +1,6 @@
 class UserBlocksController < ApplicationController
+  include UserMethods
+
   layout "site"
 
   before_action :authorize_web
@@ -37,11 +39,13 @@ class UserBlocksController < ApplicationController
 
   def create
     if @valid_params
+      now = Time.now.utc
       @user_block = UserBlock.new(
         :user => @user,
         :creator => current_user,
         :reason => params[:user_block][:reason],
-        :ends_at => Time.now.utc + @block_period.hours,
+        :created_at => now,
+        :ends_at => now + @block_period.hours,
         :needs_view => params[:user_block][:needs_view]
       )