mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-01 03:57:15 +00:00
Replace nil check using ternary operator with safe navigation operator when accessing hashes (#41884).
Using the ternary operator for nil checking caused a runtime error in the Style/SafeNavigation cop during `rubocop --regenerate-todo` with RuboCop 1.76.0. Replacing it with the safe navigation operator avoids the error. git-svn-id: https://svn.redmine.org/redmine/trunk@23824 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bb6b8e1e43
commit
40ab48325e
@ -169,7 +169,7 @@ module QueriesHelper
|
||||
group_name = format_object(group)
|
||||
end
|
||||
group_name ||= ""
|
||||
group_count = result_count_by_group ? result_count_by_group[group] : nil
|
||||
group_count = result_count_by_group&.[](group)
|
||||
group_totals = totals_by_group.map {|column, t| total_tag(column, t[group] || 0)}.join(" ").html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@ -73,7 +73,7 @@ class UserPreference < ApplicationRecord
|
||||
if has_attribute? attr_name
|
||||
super
|
||||
else
|
||||
others ? others[attr_name] : nil
|
||||
others&.[](attr_name)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user