Skip to content

Commit 1dfe6da

Browse files
Fix deprecated MenuItem arguments
Spree::BackendConfiguration::MenuItem no longer accepts the positional `sections` and `icon` arguments; `sections` is replaced by a `label:` keyword and `icon` must be passed as a keyword. Pass `label: :reports` and `icon: "file"` instead, which removes two deprecation warnings on boot. The REPORT_TABS constant was only used to supply the (now removed) positional sections argument, so inline `:reports` and drop the constant.
1 parent 3d4d2db commit 1dfe6da

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

lib/solidus_reports/engine.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@ class Engine < Rails::Engine
1717
end
1818

1919
initializer "solidus_reports.environment", before: :load_config_initializers do
20-
# rubocop:disable Lint/ConstantDefinitionInBlock
21-
# rubocop:disable Lint/OrAssignmentToConstant
22-
REPORT_TABS ||= [:reports].freeze
23-
# rubocop:enable Lint/ConstantDefinitionInBlock
24-
# rubocop:enable Lint/OrAssignmentToConstant
25-
2620
new_item = Spree::BackendConfiguration::MenuItem.new(
27-
REPORT_TABS,
28-
"file",
21+
label: :reports,
22+
icon: "file",
2923
condition: -> { can?(:admin, :reports) }
3024
)
3125
Spree::Backend::Config.menu_items << new_item

0 commit comments

Comments
 (0)