Skip to content

Commit

Permalink
Fix Rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
mamhoff authored and tvdeyen committed Jan 24, 2025
1 parent 8d921d9 commit af449d9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
3 changes: 0 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ Layout/EmptyLinesAroundAttributeAccessor:
- "core/app/models/spree/stock_quantities.rb"
- "core/app/models/spree/variant.rb"
- "core/lib/spree/app_configuration.rb"
- "core/lib/spree/permission_sets/base.rb"
- "core/lib/spree/preferences/configuration.rb"
- "core/spec/lib/spree/core/validators/email_spec.rb"
- "core/spec/models/spree/preferences/statically_configurable_spec.rb"
Expand Down Expand Up @@ -145,7 +144,6 @@ Layout/MultilineOperationIndentation:
Exclude:
- "core/lib/spree/core/engine.rb"
- "core/lib/spree/core/importer/order.rb"
- "core/lib/spree/permission_sets/default_customer.rb"
- "core/lib/spree/testing_support/factories/address_factory.rb"

# Offense count: 3
Expand Down Expand Up @@ -525,7 +523,6 @@ Style/CommentAnnotation:
- "backend/app/controllers/spree/admin/products_controller.rb"
- "backend/app/controllers/spree/admin/resource_controller.rb"
- "core/app/models/spree/payment_method/store_credit.rb"
- "core/lib/spree/permission_sets/user_management.rb"
- "core/lib/spree/testing_support/rake.rb"
- "core/spec/models/spree/variant/scopes_spec.rb"

Expand Down
1 change: 1 addition & 0 deletions core/app/models/spree/permission_sets/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def self.category
private

attr_reader :ability

delegate :can, :cannot, :user, to: :ability
end
end
Expand Down
28 changes: 14 additions & 14 deletions core/app/models/spree/permission_sets/configuration_display.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ def category
end

def activate!
can [:read, :admin], Spree::TaxCategory
can [:read, :admin], Spree::TaxRate
can [:read, :admin], Spree::Zone
can [:read, :admin], Spree::Country
can [:read, :admin], Spree::State
can [:read, :admin], Spree::PaymentMethod
can [:read, :admin], Spree::Taxonomy
can [:read, :admin], Spree::ShippingMethod
can [:read, :admin], Spree::ShippingCategory
can [:read, :admin], Spree::StockLocation
can [:read, :admin], Spree::StockMovement
can [:read, :admin], Spree::RefundReason
can [:read, :admin], Spree::ReimbursementType
can [:read, :admin], Spree::ReturnReason
can [:read, :admin], Spree::TaxCategory
can [:read, :admin], Spree::TaxRate
can [:read, :admin], Spree::Zone
can [:read, :admin], Spree::Country
can [:read, :admin], Spree::State
can [:read, :admin], Spree::PaymentMethod
can [:read, :admin], Spree::Taxonomy
can [:read, :admin], Spree::ShippingMethod
can [:read, :admin], Spree::ShippingCategory
can [:read, :admin], Spree::StockLocation
can [:read, :admin], Spree::StockMovement
can [:read, :admin], Spree::RefundReason
can [:read, :admin], Spree::ReimbursementType
can [:read, :admin], Spree::ReturnReason
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions core/app/models/spree/permission_sets/default_customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def activate!
can :create, Order do |order, token|
# same user, or both nil
order.user == user ||
# guest checkout order
order.email.present? ||
# via API, just like with show and update
(order.guest_token.present? && token == order.guest_token)
# guest checkout order
order.email.present? ||
# via API, just like with show and update
(order.guest_token.present? && token == order.guest_token)
end
can [:show, :update], Order, Order.where(user:) do |order, token|
order.user == user || (order.guest_token.present? && token == order.guest_token)
Expand Down
2 changes: 1 addition & 1 deletion core/app/models/spree/permission_sets/user_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def category
def activate!
can [:admin, :read, :create, :update, :save_in_address_book, :remove_from_address_book, :addresses, :orders, :items], Spree.user_class

# Note: This does not work with accessible_by.
# NOTE: This does not work with accessible_by.
# See https://github.com/solidusio/solidus/pull/1263
can :update_email, Spree.user_class do |user|
user.spree_roles.none?
Expand Down

0 comments on commit af449d9

Please sign in to comment.