From c7ce93e57e7609dc040bf2d4a6740bbb81e159ff Mon Sep 17 00:00:00 2001 From: lauriejefferson Date: Mon, 23 Oct 2023 12:08:31 -0400 Subject: [PATCH] Deprecate and remove dashboard code As stated by jarednorman (in #4860): > None of this provides any real value. Adding a custom dashboard is > trivial and I really don't think we need a custom permission set and > empty controller/view. --- backend/app/controllers/spree/admin/dashboards_controller.rb | 4 ++++ backend/app/views/spree/admin/dashboards/home.html.erb | 1 + core/lib/spree/permission_sets/dashboard_display.rb | 2 ++ .../models/spree/permission_sets/dashboard_display_spec.rb | 2 ++ 4 files changed, 9 insertions(+) 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/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/permission_sets/dashboard_display_spec.rb b/core/spec/models/spree/permission_sets/dashboard_display_spec.rb index b6a76cad080..1625e6a7495 100644 --- a/core/spec/models/spree/permission_sets/dashboard_display_spec.rb +++ b/core/spec/models/spree/permission_sets/dashboard_display_spec.rb @@ -10,6 +10,7 @@ context "when activated" do before do + Spree.deprecator.warn 'The dashboard_display_spec.rb test is being deprecated. Please update your source code.' described_class.new(ability).activate! end @@ -18,6 +19,7 @@ end context "when not activated" do + Spree.deprecator.warn 'The dashboard_display_spec.rb test is being deprecated. Please update your source code.' it { is_expected.not_to be_able_to(:admin, :dashboards) } it { is_expected.not_to be_able_to(:home, :dashboards) } end