Skip to content

Commit

Permalink
Follow up 0628b78 - Fixes #5091 - New timezone is not immediately ava…
Browse files Browse the repository at this point in the history
…ilable in active sessions
  • Loading branch information
mantas committed Mar 21, 2024
1 parent 3bd78b9 commit 61365ac
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .rubocop/cop/zammad/timezone_default.rb
@@ -0,0 +1,31 @@
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/

module RuboCop
module Cop
module Zammad
class TimezoneDefault < Base
def on_str(node)
return if !matching_string?(node)
return if !matching_node?(node)

add_offense(node.parent, message: <<~TEXT.chomp)
Setting.get('timezone_default_sanitized') is removed.
Please use Setting.get('timezone_default') directly.
TEXT
end

def matching_string?(node)
node.source == "'timezone_default_sanitized'"
end

def matching_node?(node)
parent = node.parent

return false if !parent

parent.receiver&.const_name == 'Setting' && parent.method_name == :get
end
end
end
end
end
1 change: 1 addition & 0 deletions .rubocop/rubocop_zammad.rb
Expand Up @@ -16,6 +16,7 @@
require_relative 'cop/zammad/migration_scheduler_last_run'
require_relative 'cop/zammad/no_to_sym_on_string'
require_relative 'cop/zammad/prefer_negated_if_over_unless'
require_relative 'cop/zammad/timezone_default'
require_relative 'cop/zammad/to_forbid_over_not_to_permit'
require_relative 'cop/zammad/trigger_from_commit_hooks'
require_relative 'cop/zammad/update_copyright'

0 comments on commit 61365ac

Please sign in to comment.