diff --git a/.github/release.yml b/.github/release.yml index f71fce019de..4e665d246cf 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -24,3 +24,6 @@ changelog: - title: Solidus Sample labels: - "changelog:solidus_sample" + - title: Solidus Promotions + labels: + - "changelog:solidus_promotions" diff --git a/CHANGELOG.md b/CHANGELOG.md index c1d48f9c25b..f965db5d616 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,210 @@ +## Solidus v4.4.0 (2024-11-12) + + + +## Solidus + +* Fix link to the community guidelines document by @rainerdema in https://github.com/solidusio/solidus/pull/5656 +* Add Admin Tailwind build when generating sandbox by @spaghetticode in https://github.com/solidusio/solidus/pull/5636 +* Add Legacy promotions gem by @mamhoff in https://github.com/solidusio/solidus/pull/5678 +* Solidus gem: Require `solidus_legacy_promotions` by @mamhoff in https://github.com/solidusio/solidus/pull/5726 +* Add missing `the` to README by @DemoYeti in https://github.com/solidusio/solidus/pull/5847 +* Bump minimum Ruby version to 3.1 by @tvdeyen in https://github.com/solidusio/solidus/pull/5891 + +## Solidus Core + +* Add Admin Tailwind build when generating sandbox by @spaghetticode in https://github.com/solidusio/solidus/pull/5636 +* Bump minimum Ruby version to 3.1 by @tvdeyen in https://github.com/solidusio/solidus/pull/5891 +* Add support for Sprockets v4 to the DummyApp by @kennyadsl in https://github.com/solidusio/solidus/pull/3379 +* [admin] Order adjustments by @elia in https://github.com/solidusio/solidus/pull/5513 +* Disable admin preview for extensions test apps by @tvdeyen in https://github.com/solidusio/solidus/pull/5600 +* Bundle solidus_admin >= 0.2 in Solidus installer by @spaghetticode in https://github.com/solidusio/solidus/pull/5607 +* Fix minor sandbox generation issues by @spaghetticode in https://github.com/solidusio/solidus/pull/5618 +* Remove call to private method `#update_cancellations` from `OrderUpdater#recalculate_adjustments` by @mamhoff in https://github.com/solidusio/solidus/pull/5633 +* Explicitly require URI in app configuration by @tvdeyen in https://github.com/solidusio/solidus/pull/5644 +* Fix down migration for promotion_orders promotions foreign key by @rabbitbike in https://github.com/solidusio/solidus/pull/5642 +* Nested Class Set extension, Promotion configuration object by @mamhoff in https://github.com/solidusio/solidus/pull/5658 +* Configurable promotion adjustment sources by @mamhoff in https://github.com/solidusio/solidus/pull/5665 +* Promotion configuration by @mamhoff in https://github.com/solidusio/solidus/pull/5635 +* Remove promotion from cancellations spec by @mamhoff in https://github.com/solidusio/solidus/pull/5639 +* Introduce a null promotion configuration by @mamhoff in https://github.com/solidusio/solidus/pull/5667 +* Make shared examples and DummyAbility require-able from outside of core by @mamhoff in https://github.com/solidusio/solidus/pull/5640 +* Deprecate Spree::Adjustment#recalculate by @mamhoff in https://github.com/solidusio/solidus/pull/5632 +* Improve test coverage for Spree::Adjustment to 100% by @mamhoff in https://github.com/solidusio/solidus/pull/5672 +* Push spec coverage for Spree::Order to 100% by @mamhoff in https://github.com/solidusio/solidus/pull/5673 +* Fix specs failing after Money 6.18.0 release by @spaghetticode in https://github.com/solidusio/solidus/pull/5680 +* Add extension point: Promotion finder by @mamhoff in https://github.com/solidusio/solidus/pull/5677 +* [Admin] Create new Tax Categories by @spaghetticode in https://github.com/solidusio/solidus/pull/5674 +* Make API independent of promotion configuration by @mamhoff in https://github.com/solidusio/solidus/pull/5686 +* Move promotion backend controllers and views to legacy_promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5685 +* Fix flaky admin stock items spec by @mamhoff in https://github.com/solidusio/solidus/pull/5701 +* Let promotion handler decide whether it can add a coupon to an order by @mamhoff in https://github.com/solidusio/solidus/pull/5684 +* Add `shipping_promotion_handler_class` attribute to null promo config by @mamhoff in https://github.com/solidusio/solidus/pull/5729 +* Fix case statement in database config template by @nvandoorn in https://github.com/solidusio/solidus/pull/5736 +* Promotion advertiser by @mamhoff in https://github.com/solidusio/solidus/pull/5739 +* Configure promotions via a configuration instance by @mamhoff in https://github.com/solidusio/solidus/pull/5738 +* fix(StoreCredit): Add display_number method by @tvdeyen in https://github.com/solidusio/solidus/pull/5741 +* [Admin] adding new shipping category by @loicginoux in https://github.com/solidusio/solidus/pull/5718 +* Rename Spree::Config.promotions.promotion_adjuster_class by @mamhoff in https://github.com/solidusio/solidus/pull/5752 +* Move shipping promotion handling to legacy promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5753 +* Create Spree::SimpleOrderContents by @mamhoff in https://github.com/solidusio/solidus/pull/5755 +* Clear order promotions in Omnes event by @mamhoff in https://github.com/solidusio/solidus/pull/5754 +* Add missing methods to null promotion configuration by @mamhoff in https://github.com/solidusio/solidus/pull/5756 +* Re-add translation for `match_choices` by @mamhoff in https://github.com/solidusio/solidus/pull/5765 +* Deprecated Configurable Class: Allow class methods by @mamhoff in https://github.com/solidusio/solidus/pull/5762 +* Move legacy integration specs by @mamhoff in https://github.com/solidusio/solidus/pull/5773 +* Rename PromotionConfiguration to LegacyPromotionConfiguration by @mamhoff in https://github.com/solidusio/solidus/pull/5769 +* NullPromotionHandler: return self from #apply by @mamhoff in https://github.com/solidusio/solidus/pull/5767 +* Disallow sprockets-rails 3.5.0 by @mamhoff in https://github.com/solidusio/solidus/pull/5778 +* Use Null Promotion Configuration in core by @mamhoff in https://github.com/solidusio/solidus/pull/5744 +* App configuration: Use SimpleOrderContents by default by @mamhoff in https://github.com/solidusio/solidus/pull/5775 +* Move promotion code batch services by @mamhoff in https://github.com/solidusio/solidus/pull/5787 +* Move Legacy Promotions Service Objects to `solidus_legacy_promotions` by @mamhoff in https://github.com/solidusio/solidus/pull/5786 +* Allow Psych 5 by @tvdeyen in https://github.com/solidusio/solidus/pull/5788 +* Require legacy promotion configuration in legacy_promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5796 +* Extract Legacy Promotion System: Move ActiveRecord Models and Factories by @mamhoff in https://github.com/solidusio/solidus/pull/5634 +* Move adjustment promotion code id to legacy promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5800 +* Remove spree_orders_promotions from core migration by @mamhoff in https://github.com/solidusio/solidus/pull/5803 +* Lock solidus_core.gemspec to ransack '< 4.2' by @MadelineCollier in https://github.com/solidusio/solidus/pull/5812 +* Use new extension point in order updater spec by @mamhoff in https://github.com/solidusio/solidus/pull/5814 +* Raise on deprecation when `SOLIDUS_RAISE_DEPRECATIONS` set by @forkata in https://github.com/solidusio/solidus/pull/5813 +* Destroy wallet payment source on source destroy by @tvdeyen in https://github.com/solidusio/solidus/pull/5836 +* Move eligible column to legacy promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5802 +* [Admin] Add new migrations and validations in `core` to support new `admin` `Spree::Role` interface by @MadelineCollier in https://github.com/solidusio/solidus/pull/5833 +* Decorate Default Return Refund Amount Calculator in LegacyPromotions by @mamhoff in https://github.com/solidusio/solidus/pull/5845 +* [Admin] Allow assignment of permission sets when creating/editing admin roles by @MadelineCollier in https://github.com/solidusio/solidus/pull/5846 +* [Admin] Display `last_sign_in_at` in users admin, change default scope by @MadelineCollier in https://github.com/solidusio/solidus/pull/5850 +* Add Ransack 4.2 support by @tvdeyen in https://github.com/solidusio/solidus/pull/5853 +* Spree::Variant.in_stock: Only show distinct variants by @mamhoff in https://github.com/solidusio/solidus/pull/5860 +* [Admin] New admin user edit page by @MadelineCollier in https://github.com/solidusio/solidus/pull/5856 +* Performance: Remove includes from Spree::Variant#options_text by @mamhoff in https://github.com/solidusio/solidus/pull/5867 +* Add template variants scope by @mamhoff in https://github.com/solidusio/solidus/pull/5866 +* Allow Rails 7.2 by @tvdeyen in https://github.com/solidusio/solidus/pull/5843 +* Deprecate and remove dashboard code by @nvandoorn in https://github.com/solidusio/solidus/pull/5883 +* Legacy Promotions: Move ransackable promo associations from core by @mamhoff in https://github.com/solidusio/solidus/pull/5893 +* FixUpdate return_reasons.rb by @fthobe in https://github.com/solidusio/solidus/pull/5901 + +## Solidus Admin + +* Bump minimum Ruby version to 3.1 by @tvdeyen in https://github.com/solidusio/solidus/pull/5891 +* [admin] Order adjustments by @elia in https://github.com/solidusio/solidus/pull/5513 +* Fix minor sandbox generation issues by @spaghetticode in https://github.com/solidusio/solidus/pull/5618 +* [Admin] Create new Tax Categories by @spaghetticode in https://github.com/solidusio/solidus/pull/5674 +* Move promotion backend controllers and views to legacy_promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5685 +* Fix flaky admin stock items spec by @mamhoff in https://github.com/solidusio/solidus/pull/5701 +* [Admin] adding new shipping category by @loicginoux in https://github.com/solidusio/solidus/pull/5718 +* Move adjustment promotion code id to legacy promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5800 +* Lock solidus_core.gemspec to ransack '< 4.2' by @MadelineCollier in https://github.com/solidusio/solidus/pull/5812 +* Move eligible column to legacy promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5802 +* [Admin] Allow assignment of permission sets when creating/editing admin roles by @MadelineCollier in https://github.com/solidusio/solidus/pull/5846 +* [Admin] Display `last_sign_in_at` in users admin, change default scope by @MadelineCollier in https://github.com/solidusio/solidus/pull/5850 +* Add Ransack 4.2 support by @tvdeyen in https://github.com/solidusio/solidus/pull/5853 +* [Admin] New admin user edit page by @MadelineCollier in https://github.com/solidusio/solidus/pull/5856 +* Fix property destroy - use destroy instead of discard by @tonxyx in https://github.com/solidusio/solidus/pull/5577 +* [Admin] Introduce base Index Component by @rainerdema in https://github.com/solidusio/solidus/pull/5561 +* Restore coverage tracking by @elia in https://github.com/solidusio/solidus/pull/5580 +* [admin] Fix mock components reported location by @elia in https://github.com/solidusio/solidus/pull/5589 +* [admin] Require ViewComponent v3.9 with inheritable translations by @elia in https://github.com/solidusio/solidus/pull/5590 +* [admin] Remove previews for non-UI components that didn't add much value by @elia in https://github.com/solidusio/solidus/pull/5592 +* [admin] Consistently use `label` for providing text for table scopes, batch actions and filters by @elia in https://github.com/solidusio/solidus/pull/5593 +* [admin] Reduce the size of the panels title by @elia in https://github.com/solidusio/solidus/pull/5594 +* fix(admin stock items spec): Wait for tab to be active by @tvdeyen in https://github.com/solidusio/solidus/pull/5601 +* [admin] Document SolidusAdmin intended usage and how to contribute by @elia in https://github.com/solidusio/solidus/pull/5595 +* [ADMIN] Fix flash messages coloring by @spaghetticode in https://github.com/solidusio/solidus/pull/5681 +* Convert existing Admin modals to Turbo frames by @spaghetticode in https://github.com/solidusio/solidus/pull/5688 +* [admin] fix docs links in README by @ccarruitero in https://github.com/solidusio/solidus/pull/5703 +* Make SolidusAdmin's testing support code require-able by @mamhoff in https://github.com/solidusio/solidus/pull/5700 +* [Admin] Add the ability to configure batch action confirmation by @forkata in https://github.com/solidusio/solidus/pull/5702 +* Show the page action for creating a new shipping method by @forkata in https://github.com/solidusio/solidus/pull/5719 +* [Admin] Create new Refund Reasons by @spaghetticode in https://github.com/solidusio/solidus/pull/5696 +* [Admin] Add Update Tax Category feature by @spaghetticode in https://github.com/solidusio/solidus/pull/5697 +* Move solidus admin promotion to legacy promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5724 +* Show "Unavailable" status for products with a future `Available On` date by @forkata in https://github.com/solidusio/solidus/pull/5734 +* Docker development environment improvements by @nvandoorn in https://github.com/solidusio/solidus/pull/5735 +* Create custom orders index component for solidus_legacy_promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5779 +* Use configurable adjustment promotion source types in Thumbnail.for by @mamhoff in https://github.com/solidusio/solidus/pull/5781 +* Fix flaky spec with sleep by @mamhoff in https://github.com/solidusio/solidus/pull/5783 +* Components registry safe reload by @mamhoff in https://github.com/solidusio/solidus/pull/5780 +* SolidusAdmin: Components per Adjustment Source by @mamhoff in https://github.com/solidusio/solidus/pull/5789 +* Support Tailwind CSS in core dummy app by @mamhoff in https://github.com/solidusio/solidus/pull/5798 +* Admin adjustable components by @mamhoff in https://github.com/solidusio/solidus/pull/5791 +* [Admin] Create new Adjustment Reasons by @MadelineCollier in https://github.com/solidusio/solidus/pull/5811 +* Add before action to handle option type params by @nvandoorn in https://github.com/solidusio/solidus/pull/5816 +* [Admin] Adjustment Reasons edit/update by @MadelineCollier in https://github.com/solidusio/solidus/pull/5815 +* [Admin] Shipping Categories edit/update by @MadelineCollier in https://github.com/solidusio/solidus/pull/5817 +* [Admin] Refund Reasons edit/update by @MadelineCollier in https://github.com/solidusio/solidus/pull/5819 +* [Admin] Create new Store Credit Reasons by @MadelineCollier in https://github.com/solidusio/solidus/pull/5820 +* [Admin] Store Credit Reasons edit/update & New request specs to appease Codecov by @MadelineCollier in https://github.com/solidusio/solidus/pull/5821 +* [Admin] Add request spec for Refund Reasons & other minor edits by @MadelineCollier in https://github.com/solidusio/solidus/pull/5822 +* Remove unused load methods & Add more request spec coverage by @MadelineCollier in https://github.com/solidusio/solidus/pull/5825 +* [Admin] Introduce RMA reasons creation & modification capability by @MadelineCollier in https://github.com/solidusio/solidus/pull/5829 +* [Admin] Introduce role creation by @MadelineCollier in https://github.com/solidusio/solidus/pull/5831 +* [SolidusAdmin] Remove inaccessible details/summary element by @mamhoff in https://github.com/solidusio/solidus/pull/5835 +* [Admin] Edit/Update roles via new admin UI by @MadelineCollier in https://github.com/solidusio/solidus/pull/5828 +* Standardize admin controller setup methods by @MadelineCollier in https://github.com/solidusio/solidus/pull/5842 +* [Admin] Update Spree::Role admin UI with descriptions & required names by @MadelineCollier in https://github.com/solidusio/solidus/pull/5844 +* [Admin] Add new users admin addresses page by @MadelineCollier in https://github.com/solidusio/solidus/pull/5865 +* [Admin] Add new users admin order history page by @MadelineCollier in https://github.com/solidusio/solidus/pull/5869 +* [Admin] Handle states_required? in admin address component by @MadelineCollier in https://github.com/solidusio/solidus/pull/5871 +* Add filtering by store to orders index component by @forkata in https://github.com/solidusio/solidus/pull/5870 +* [Admin] Add new users admin items page by @MadelineCollier in https://github.com/solidusio/solidus/pull/5874 +* Update Tailwind executable call for v3.0 by @forkata in https://github.com/solidusio/solidus/pull/5877 +* Admin installer fixes by @tvdeyen in https://github.com/solidusio/solidus/pull/5880 +* [Admin] Add new users admin store credits page by @MadelineCollier in https://github.com/solidusio/solidus/pull/5887 +* Exclude 'remixicon.symbol.svg' from asset pipeline by @stewart in https://github.com/solidusio/solidus/pull/5878 + +## Solidus Backend + +* Bump minimum Ruby version to 3.1 by @tvdeyen in https://github.com/solidusio/solidus/pull/5891 +* Nested Class Set extension, Promotion configuration object by @mamhoff in https://github.com/solidusio/solidus/pull/5658 +* Promotion configuration by @mamhoff in https://github.com/solidusio/solidus/pull/5635 +* Move promotion backend controllers and views to legacy_promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5685 +* App configuration: Use SimpleOrderContents by default by @mamhoff in https://github.com/solidusio/solidus/pull/5775 +* Move eligible column to legacy promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5802 +* Allow Rails 7.2 by @tvdeyen in https://github.com/solidusio/solidus/pull/5843 +* Deprecate and remove dashboard code by @nvandoorn in https://github.com/solidusio/solidus/pull/5883 +* Docker development environment improvements by @nvandoorn in https://github.com/solidusio/solidus/pull/5735 +* Fix the check on select2 translations asset existence by @elia in https://github.com/solidusio/solidus/pull/5582 +* Use `spree` routing proxy in theme selection partial by @mamhoff in https://github.com/solidusio/solidus/pull/5599 +* Theme selection for Solidus Admin: Use spree routing proxy by @mamhoff in https://github.com/solidusio/solidus/pull/5604 +* Menu item should not match url if match_path is set by @sascha-karnatz in https://github.com/solidusio/solidus/pull/5643 +* Fix search by variant on stock items by @nvandoorn in https://github.com/solidusio/solidus/pull/5660 +* Use routing proxy in locale selection by @mamhoff in https://github.com/solidusio/solidus/pull/5611 +* Fix JS locale data for release of Money 6.19 by @mamhoff in https://github.com/solidusio/solidus/pull/5683 +* Do not show theme selector if only one theme is configured by @tvdeyen in https://github.com/solidusio/solidus/pull/5705 +* Move promotion admin assets by @mamhoff in https://github.com/solidusio/solidus/pull/5699 +* Add routes proxy to locale selection path helper by @mamhoff in https://github.com/solidusio/solidus/pull/5716 +* Fix flaky admin customer return spec by @mamhoff in https://github.com/solidusio/solidus/pull/5757 +* Fix deprecation warning from Ransack by @mamhoff in https://github.com/solidusio/solidus/pull/5764 +* Backend: Make order search fields configurable by @mamhoff in https://github.com/solidusio/solidus/pull/5776 +* Call empty only on incomplete orders by @nvandoorn in https://github.com/solidusio/solidus/pull/5827 +* Format date with #to_fs by @alepore in https://github.com/solidusio/solidus/pull/5863 +* Variant Autocomplete: Allow passing select2 options by @mamhoff in https://github.com/solidusio/solidus/pull/5861 +* Render variant shipping category by @nvandoorn in https://github.com/solidusio/solidus/pull/5882 + +## Solidus API + +* Bump minimum Ruby version to 3.1 by @tvdeyen in https://github.com/solidusio/solidus/pull/5891 +* Promotion configuration by @mamhoff in https://github.com/solidusio/solidus/pull/5635 +* Add extension point: Promotion finder by @mamhoff in https://github.com/solidusio/solidus/pull/5677 +* Make API independent of promotion configuration by @mamhoff in https://github.com/solidusio/solidus/pull/5686 +* Use Null Promotion Configuration in core by @mamhoff in https://github.com/solidusio/solidus/pull/5744 +* App configuration: Use SimpleOrderContents by default by @mamhoff in https://github.com/solidusio/solidus/pull/5775 +* Move adjustment promotion code id to legacy promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5800 +* Move eligible column to legacy promotions by @mamhoff in https://github.com/solidusio/solidus/pull/5802 +* Call empty only on incomplete orders by @nvandoorn in https://github.com/solidusio/solidus/pull/5827 +* SolidusLegacyPromotion extraction: Move and fix remaining API specs by @mamhoff in https://github.com/solidusio/solidus/pull/5694 +* Do not initialize promotions object on startup by @mamhoff in https://github.com/solidusio/solidus/pull/5728 +* Fix failing API promotions specs by @MadelineCollier in https://github.com/solidusio/solidus/pull/5859 + +## Solidus Sample + +* Bump minimum Ruby version to 3.1 by @tvdeyen in https://github.com/solidusio/solidus/pull/5891 +* Add missing option types to product sample data by @spaghetticode in https://github.com/solidusio/solidus/pull/5638 + +**Full Changelog**: https://github.com/solidusio/solidus/compare/v4.3.0...v4.4.0 + + ## Solidus v4.3.3 (2024-03-11) diff --git a/backend/app/controllers/spree/admin/dashboards_controller.rb b/backend/app/controllers/spree/admin/dashboards_controller.rb index 979f4611371..90a4c91a5c2 100644 --- a/backend/app/controllers/spree/admin/dashboards_controller.rb +++ b/backend/app/controllers/spree/admin/dashboards_controller.rb @@ -3,6 +3,10 @@ module Spree module Admin class DashboardsController < BaseController + before_action :deprecate + def deprecate + Spree.deprecator.warn "The #{self.class.name} is deprecated. If you still use dashboards, please copy all controllers and views from solidus_backend to your application." + end end end end diff --git a/backend/app/views/spree/admin/dashboards/home.html.erb b/backend/app/views/spree/admin/dashboards/home.html.erb index 83cfc00d42f..66b6f11fc15 100644 --- a/backend/app/views/spree/admin/dashboards/home.html.erb +++ b/backend/app/views/spree/admin/dashboards/home.html.erb @@ -1 +1,2 @@ <%# Placeholder view for a home dashboard %> +

<%= Spree.deprecator.warn "The Home view is deprecated, If you still use dashboards, please copy all controllers and views from solidus_backend to your application." %>

diff --git a/core/app/models/spree/order.rb b/core/app/models/spree/order.rb index b9b1810b917..97cee9f75c3 100644 --- a/core/app/models/spree/order.rb +++ b/core/app/models/spree/order.rb @@ -62,7 +62,7 @@ class CannotRebuildShipments < StandardError; end go_to_state :confirm end - self.allowed_ransackable_associations = %w[shipments user order_promotions promotions bill_address ship_address line_items] + self.allowed_ransackable_associations = %w[shipments user bill_address ship_address line_items] self.allowed_ransackable_attributes = %w[completed_at created_at email number state payment_state shipment_state total store_id] attr_reader :coupon_code diff --git a/core/db/default/spree/return_reasons.rb b/core/db/default/spree/return_reasons.rb index b3f1b5c0285..ddee6ae6393 100644 --- a/core/db/default/spree/return_reasons.rb +++ b/core/db/default/spree/return_reasons.rb @@ -3,7 +3,9 @@ Spree::ReturnReason.find_or_create_by(name: 'Better price available') Spree::ReturnReason.find_or_create_by(name: 'Missed estimated delivery date') Spree::ReturnReason.find_or_create_by(name: 'Missing parts or accessories') -Spree::ReturnReason.find_or_create_by(name: 'Damaged/Defective') +Spree::ReturnReason.find_or_create_by(name: 'Damaged during transport') +Spree::ReturnReason.find_or_create_by(name: 'Defective within warranty period') +Spree::ReturnReason.find_or_create_by(name: 'Other defects or damages') Spree::ReturnReason.find_or_create_by(name: 'Different from what was ordered') Spree::ReturnReason.find_or_create_by(name: 'Different from description') Spree::ReturnReason.find_or_create_by(name: 'No longer needed/wanted') diff --git a/core/lib/generators/solidus/install/app_templates/frontend/starter.rb b/core/lib/generators/solidus/install/app_templates/frontend/starter.rb index 2e40f15aaec..7a6c7ee377d 100644 --- a/core/lib/generators/solidus/install/app_templates/frontend/starter.rb +++ b/core/lib/generators/solidus/install/app_templates/frontend/starter.rb @@ -1 +1 @@ -apply 'https://github.com/solidusio/solidus_starter_frontend/raw/rails-7.2/template.rb' +apply 'https://github.com/solidusio/solidus_starter_frontend/raw/main/template.rb' diff --git a/core/lib/spree/core/version.rb b/core/lib/spree/core/version.rb index c5ec0585411..ced47297368 100644 --- a/core/lib/spree/core/version.rb +++ b/core/lib/spree/core/version.rb @@ -1,14 +1,14 @@ # frozen_string_literal: true module Spree - VERSION = "4.4.0.dev" + VERSION = "4.5.0.dev" def self.solidus_version VERSION end def self.previous_solidus_minor_version - '4.3' + '4.4' end def self.solidus_gem_version diff --git a/core/lib/spree/permission_sets/dashboard_display.rb b/core/lib/spree/permission_sets/dashboard_display.rb index ce268973306..09e43a70b31 100644 --- a/core/lib/spree/permission_sets/dashboard_display.rb +++ b/core/lib/spree/permission_sets/dashboard_display.rb @@ -19,6 +19,8 @@ def category end def activate! + Spree.deprecator.warn "The #{self.class.name} module is deprecated. " \ + "If you still use dashboards, please copy all controllers and views from #{self.class.name} to your application." can [:admin, :home], :dashboards end end diff --git a/core/spec/models/spree/order_spec.rb b/core/spec/models/spree/order_spec.rb index 07296deb22f..86c75f11ec3 100644 --- a/core/spec/models/spree/order_spec.rb +++ b/core/spec/models/spree/order_spec.rb @@ -7,6 +7,12 @@ let(:user) { create(:user, email: "solidus@example.com") } let(:order) { create(:order, user:, store:) } + describe ".ransackable_associations" do + subject { described_class.ransackable_associations } + + it { is_expected.to contain_exactly("user", "line_items", "shipments", "bill_address", "ship_address") } + end + context '#store' do it { is_expected.to respond_to(:store) } diff --git a/core/spec/models/spree/permission_sets/dashboard_display_spec.rb b/core/spec/models/spree/permission_sets/dashboard_display_spec.rb deleted file mode 100644 index b6a76cad080..00000000000 --- a/core/spec/models/spree/permission_sets/dashboard_display_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' -require 'spree/testing_support/dummy_ability' - -RSpec.describe Spree::PermissionSets::DashboardDisplay do - let(:ability) { DummyAbility.new } - - subject { ability } - - context "when activated" do - before do - described_class.new(ability).activate! - end - - it { is_expected.to be_able_to(:admin, :dashboards) } - it { is_expected.to be_able_to(:home, :dashboards) } - end - - context "when not activated" do - it { is_expected.not_to be_able_to(:admin, :dashboards) } - it { is_expected.not_to be_able_to(:home, :dashboards) } - end - - describe ".privilege" do - it "returns the correct privilege symbol" do - expect(described_class.privilege).to eq(:other) - end - end - - describe ".category" do - it "returns the correct category symbol" do - expect(described_class.category).to eq(:dashboard_display) - end - end -end diff --git a/docker-compose.yml b/docker-compose.yml index 0ad28fedc22..996d1b0d6f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ services: NODE_VERSION: 20 MYSQL_VERSION: "8.0" BUNDLER_VERSION: 2 - image: solidus-4.4.0.dev + image: solidus-4.5.0.dev command: bash -c "(bundle check || bundle) && bash -c 'echo Container initialized, see README.md for further steps.' && tail -f /dev/null" environment: CAPYBARA_DRIVER: selenium_chrome_headless_docker_friendly diff --git a/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_order_decorator.rb b/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_order_decorator.rb index a0a5680448d..278c565fa75 100644 --- a/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_order_decorator.rb +++ b/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_order_decorator.rb @@ -2,6 +2,12 @@ module SolidusLegacyPromotions module SpreeOrderDecorator + module ClassMethods + def allowed_ransackable_associations + super + ["promotions", "order_promotions"] + end + end + def self.prepended(base) base.has_many :order_promotions, class_name: 'Spree::OrderPromotion', dependent: :destroy base.has_many :promotions, through: :order_promotions @@ -17,5 +23,6 @@ def shipping_discount end Spree::Order.prepend(self) + Spree::Order.singleton_class.prepend self::ClassMethods end end diff --git a/legacy_promotions/lib/tasks/solidus_legacy_promotions/delete_ineligible_adjustments.rake b/legacy_promotions/lib/tasks/solidus_legacy_promotions/delete_ineligible_adjustments.rake new file mode 100644 index 00000000000..ee8e8a01243 --- /dev/null +++ b/legacy_promotions/lib/tasks/solidus_legacy_promotions/delete_ineligible_adjustments.rake @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +namespace :solidus_legacy_promotions do + desc "Delete ineligible adjustments" + task delete_ineligible_adjustments: :environment do + Spree::Adjustment.where(eligible: false).delete_all + end +end diff --git a/legacy_promotions/spec/models/spree/order_spec.rb b/legacy_promotions/spec/models/spree/order_spec.rb index 9680149ed50..7dbb6ea0c30 100644 --- a/legacy_promotions/spec/models/spree/order_spec.rb +++ b/legacy_promotions/spec/models/spree/order_spec.rb @@ -7,6 +7,12 @@ it { is_expected.to respond_to(:order_promotions) } it { is_expected.to respond_to(:promotions) } + describe ".ransackable_associations" do + subject { described_class.ransackable_associations } + + it { is_expected.to include("promotions", "order_promotions") } + end + context "#apply_shipping_promotions" do let(:order) { build(:order) } diff --git a/promotions/MIGRATING.md b/promotions/MIGRATING.md index 4c4841dbbd6..a1c997006ab 100644 --- a/promotions/MIGRATING.md +++ b/promotions/MIGRATING.md @@ -1,6 +1,10 @@ -# Migrating from Solidus' promotion system to SolidusPromotions +# Migrating from `solidus_legacy_promotions` to `solidus_promotions` -The system is designed to completely replace the Solidus promotion system. Follow these steps to migrate your store to the gem: +The system is designed to completely replace the legacy promotion system. This guide shows you how +to run both systems side-by-side, migrate your store's configuration to the `solidus_promotions`, and +finally remove the dependency on `solidus_legacy_promotions`. + +Follow these steps to migrate your store to the gem: ## Install solidus_promotions @@ -17,9 +21,9 @@ bundle install bundle exec rails generate solidus_promotions:install ``` -This will install the extension. It will add new tables, and new routes. It will also generate an initializer in `config/initializers/solidus_promotions.rb`. +This will install the extension. It will add new tables, and new routes. It will also change your initializer in `config/initializers/spree.rb`. -For the time being, comment out the following lines: +For the time being, leave the following lines commented out: ```rb # Make sure we use Spree::SimpleOrderContents @@ -88,7 +92,7 @@ Stores that have a custom coupon codes controller, such as Solidus' starter fron If you have custom promotion rules or actions, you need to create new conditions and benefits, respectively. > [!IMPORTANT] -> SolidusPromotions currently only supports actions that discount line items and shipments, as well as creating discounted line items. If you have actions that create order-level adjustments, we currently have no support for that. +> SolidusPromotions only supports actions that discount line items and shipments, as well as creating discounted line items. If you have actions that create order-level adjustments, we have no support for that. In our experience, using the three actions can do almost all the things necessary, since they are customizable using calculators. @@ -148,3 +152,33 @@ require 'my_promotion_map' SolidusPromotions::PromotionMigrator.new(MY_PROMOTION_MAP).call ``` + +## Removing `solidus_legacy_promotions` + +Once your store runs on `solidus_promotions`, you can now drop the dependency on `solidus_legacy_promotions`. +In order to do so, first make sure you have no ineligible promotion adjustments left in your database: + +```rb +>> Spree::Adjustment.where(eligible: false) +=> 0 +>> +``` + +If you still have ineligible adjustments in your database, run the following command: + +```sh +bundle exec rails solidus_legacy_promotions:delete_ineligible_adjustments +``` + +Now you can safely remove `solidus_legacy_promotions` from your `Gemfile`. If your store depends on the whole `solidus` suite, +replace that dependency declaration in the `Gemfile` with the individual gems: + +```diff +# Gemfile +- gem 'solidus', '~> 4,4' ++ gem 'solidus_core', '~> 4.4' ++ gem 'solidus_api', '~> 4.4' ++ gem 'solidus_backend', '~> 4.4' ++ gem 'solidus_admin', '~> 4.4' ++ gem 'solidus_promotions', '~> 4.4' +``` diff --git a/tasks/releasing.rake b/tasks/releasing.rake index 4142046b470..4336ea0f3ce 100644 --- a/tasks/releasing.rake +++ b/tasks/releasing.rake @@ -2,7 +2,7 @@ require 'bundler/gem_tasks' -SOLIDUS_GEM_NAMES = %w[core api backend sample] +SOLIDUS_GEM_NAMES = %w[core api backend sample promotions] %w[build install].each do |task_name| desc "Run rake #{task} for each Solidus gem" diff --git a/tasks/testing.rake b/tasks/testing.rake index 7dee5cbb90a..8ed89ec92c3 100644 --- a/tasks/testing.rake +++ b/tasks/testing.rake @@ -18,13 +18,14 @@ def subproject_task(project, task, title: project, task_name: nil) end %w[spec db:drop db:create db:migrate db:reset].each do |task| - %w(api backend core frontend sample).each do |project| + solidus_gem_names = %w[core api backend sample promotions] + solidus_gem_names.each do |project| desc "Run specs for #{project}" if task == 'spec' subproject_task(project, task) end desc "Run rake #{task} for each Solidus engine" - task task => %w(api backend core frontend sample).map { |p| "#{task}:#{p}" } + task task => solidus_gem_names.map { |p| "#{task}:#{p}" } end desc "Run backend JS specs"