From 2b422d85dec8dcf631d564dfdddfadad7e1fce35 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Wed, 29 Jun 2022 09:28:17 +0200 Subject: [PATCH] use Time.current instead of Time.zone.now. Time.zone.now is nil without timezone starting with Rails7 --- lib/additionals.rb | 2 +- lib/additionals/patches/time_entry_patch.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/additionals.rb b/lib/additionals.rb index a1e69a88..a2f7a797 100644 --- a/lib/additionals.rb +++ b/lib/additionals.rb @@ -25,7 +25,7 @@ module Additionals def now_with_user_time_zone(user = User.current) if user.time_zone.nil? - Time.zone.now + Time.current else user.time_zone.now end diff --git a/lib/additionals/patches/time_entry_patch.rb b/lib/additionals/patches/time_entry_patch.rb index 19eefbfa..1a7b2e74 100644 --- a/lib/additionals/patches/time_entry_patch.rb +++ b/lib/additionals/patches/time_entry_patch.rb @@ -27,7 +27,7 @@ module Additionals def validate_issue_allowed return unless issue_id && issue # NOTE: do not use user time zone here, because issue do not use it - return if Setting.commit_logtime_enabled? && (issue.updated_on + 5.seconds) > Time.zone.now + return if Setting.commit_logtime_enabled? && (issue.updated_on + 5.seconds) > Time.current errors.add :issue_id, :issue_log_time_not_allowed unless issue.log_time_allowed? end