use Time.current instead of Time.zone.now. Time.zone.now is nil without timezone starting with Rails7

This commit is contained in:
Alexander Meindl 2022-06-29 09:28:17 +02:00
parent cbf929021b
commit 2b422d85de
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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