Skip to content

Commit 15818b0

Browse files
committed
Move Patches out of Spree namespace
This names the patches such that they do not live in the Spree namespace. It also fixes a Rubocop offense.
1 parent 3234e49 commit 15818b0

File tree

4 files changed

+30
-24
lines changed

4 files changed

+30
-24
lines changed

lib/patches/backend/controllers/spree/admin/base_controller_patch.rb renamed to lib/patches/backend/controllers/solidus_auth_devise/admin/base_controller_patch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
module Spree
3+
module SolidusAuthDevise
44
module Admin
55
module BaseControllerPatch
66
protected
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# frozen_string_literal: true
2+
3+
module SolidusAuthDevise
4+
module Admin
5+
module Orders
6+
module CustomerDetailsControllerPatch
7+
def self.prepended(base)
8+
base.before_action :check_authorization
9+
end
10+
11+
private
12+
13+
def check_authorization
14+
load_order
15+
session[:access_token] ||= params[:token]
16+
17+
resource = @order
18+
action = params[:action].to_sym
19+
action = :edit if action == :show # show route renders :edit for this controller
20+
21+
authorize! action, resource, session[:access_token]
22+
end
23+
24+
Spree::Admin::Orders::CustomerDetailsController.prepend self
25+
end
26+
end
27+
end
28+
end

lib/patches/backend/controllers/spree/admin/orders/customer_details_controller_patch.rb

Lines changed: 0 additions & 22 deletions
This file was deleted.

lib/patches/frontend/controllers/spree/checkout_controller_patch.rb renamed to lib/patches/frontend/controllers/solidus_auth_devise/checkout_controller_patch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
module Spree
3+
module SolidusAuthDevise
44
module CheckoutControllerPatch
55
def self.prepended(base)
66
base.before_action :check_registration, except: [:registration, :update_registration]

0 commit comments

Comments
 (0)