solidusio / solidusio/solidus_subscriptions
Solidus Deprecation Warning for MenuItem: Passing sections to MenuItem is deprecated. Please pass a label instead.
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 49
- Forks
- 53
- Avg merge
- 4h 54m
- Merged PRs (30d)
- 1
Description
When starting Solidus with the solidus_subscriptions gem, we get a deprecation warning:
DEPRECATION WARNING: Passing sections to Spree::BackendConfiguration::MenuItem is deprecated. Please pass a label instead. (called from new at /home/erwin/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/bundler/gems/solidus_subscriptions-1149f416b1be/lib/solidus_subscriptions/engine.rb:43)
DEPRECATION WARNING: Passing icon to Spree::BackendConfiguration::MenuItem is deprecated. Please use the keyword argument instead. (called from new at /home/erwin/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/bundler/gems/solidus_subscriptions-1149f416b1be/lib/solidus_subscriptions/engine.rb:43)
Looks like this comes from:
Per the Solidus documentation, seems the format has changed to:
https://guides.solidus.io/customization/customizing-the-backend#adding-new-menu-items
# ...
config.menu_items << config.class::MenuItem.new(
label: :rejected_orders,
icon: 'ban',
url: '/admin/orders?q[rejected_eq]=true' )
Solidus Version:
4.2.3
Additional context
Not a major issue. Just would be a better experience for new developers and existing developers to update this and clear the warning on rails server startup.
Fix
I think if you just change the structure to the following, it should work and clear the deprecation notice:
config.menu_items << config.class::MenuItem.new(
label: :subscriptions,
icon: 'repeat',
url: :admin_subscriptions_path,
condition: ->{ can?(:admin, SolidusSubscriptions::Subscription) },
match_path: '/subscriptions'
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open lib/solidus_subscriptions/engine.rb at line 43 and compare the MenuItem arguments with the Solidus backend menu documentation linked in the issue. Start the Solidus application with solidus_subscriptions and verify that the deprecation warnings no longer appear during server startup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100