X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a55883290b766bafd88f5cd23aeb2e90ecf5467f..fb854652ea47d7b3fa1657722f1da768eaba4f25:/app/controllers/user_blocks_controller.rb?ds=inline diff --git a/app/controllers/user_blocks_controller.rb b/app/controllers/user_blocks_controller.rb index 3b7ef30f9..962eff04c 100644 --- a/app/controllers/user_blocks_controller.rb +++ b/app/controllers/user_blocks_controller.rb @@ -75,11 +75,14 @@ class UserBlocksController < ApplicationController if !user_block_was_active && @user_block.active? flash.now[:error] = t(".inactive_block_cannot_be_reactivated") render :action => "edit" - elsif @user_block.save - flash[:notice] = t(".success") - redirect_to @user_block else - render :action => "edit" + @user_block.ends_at = @user_block.ends_at_was unless user_block_was_active + if @user_block.save + flash[:notice] = t(".success") + redirect_to @user_block + else + render :action => "edit" + end end end else