mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix logical problem in spree/api/base_controller and in spree/checkout_controller
See this stack overflow post for more info: https://stackoverflow.com/questions/39629976/ruby-return-vs-and-return
This commit is contained in:
@@ -60,7 +60,7 @@ module Spree
|
||||
!Spree::Api::Config[:requires_authentication]
|
||||
|
||||
return if api_key.present?
|
||||
render "spree/api/errors/must_specify_api_key", status: :unauthorized && return
|
||||
render("spree/api/errors/must_specify_api_key", status: :unauthorized) && return
|
||||
end
|
||||
|
||||
def authenticate_user
|
||||
@@ -68,7 +68,7 @@ module Spree
|
||||
|
||||
if requires_authentication? || api_key.present?
|
||||
unless @current_api_user = Spree.user_class.find_by_spree_api_key(api_key.to_s)
|
||||
render "spree/api/errors/invalid_api_key", status: :unauthorized && return
|
||||
render("spree/api/errors/invalid_api_key", status: :unauthorized) && return
|
||||
end
|
||||
else
|
||||
# An anonymous user
|
||||
@@ -77,12 +77,12 @@ module Spree
|
||||
end
|
||||
|
||||
def unauthorized
|
||||
render "spree/api/errors/unauthorized", status: :unauthorized && return
|
||||
render("spree/api/errors/unauthorized", status: :unauthorized) && return
|
||||
end
|
||||
|
||||
def error_during_processing(exception)
|
||||
render text: { exception: exception.message }.to_json,
|
||||
status: :unprocessable_entity && return
|
||||
render(text: { exception: exception.message }.to_json,
|
||||
status: :unprocessable_entity) && return
|
||||
end
|
||||
|
||||
def requires_authentication?
|
||||
@@ -90,7 +90,7 @@ module Spree
|
||||
end
|
||||
|
||||
def not_found
|
||||
render "spree/api/errors/not_found", status: :not_foun && return
|
||||
render("spree/api/errors/not_found", status: :not_found) && return
|
||||
end
|
||||
|
||||
def current_ability
|
||||
|
||||
@@ -29,7 +29,7 @@ module Spree
|
||||
|
||||
def load_order
|
||||
@order = current_order
|
||||
redirect_to main_app.cart_path && return unless @order
|
||||
redirect_to(main_app.cart_path) && return unless @order
|
||||
|
||||
if params[:state]
|
||||
redirect_to checkout_state_path(@order.state) if @order.can_go_to_state?(params[:state])
|
||||
|
||||
Reference in New Issue
Block a user