+ unless user_block_was_active
+ @user_block.ends_at = @user_block.ends_at_was
+ @user_block.deactivates_at = @user_block.deactivates_at_was
+ @user_block.deactivates_at = [@user_block.ends_at, @user_block.updated_at].max unless @user_block.deactivates_at # take updated_at into account before deactivates_at is backfilled
+ end
+ if @user_block.save
+ flash[:notice] = t(".success")
+ redirect_to @user_block
+ else
+ render :action => "edit"
+ end