]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_blocks_controller.rb
Don't update deactivates_at if block was already viewed
[rails.git] / app / controllers / user_blocks_controller.rb
index c42c2659db0b09aae46b17430b3cac0e25283790..d427e5fa515bee1b2a4454cc1b1624a112d794cf 100644 (file)
@@ -29,7 +29,7 @@ class UserBlocksController < ApplicationController
   end
 
   def show
   end
 
   def show
-    if current_user && current_user == @user_block.user
+    if current_user && current_user == @user_block.user && !@user_block.deactivates_at
       @user_block.needs_view = false
       @user_block.deactivates_at = [@user_block.ends_at, Time.now.utc].max
       @user_block.save!
       @user_block.needs_view = false
       @user_block.deactivates_at = [@user_block.ends_at, Time.now.utc].max
       @user_block.save!