mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
Merge pull request #12582 from cyrillefr/FixRails_UnusedRenderContentIssues
Fixes offenses raised by Rails/UnusedRenderContent
This commit is contained in:
@@ -746,17 +746,6 @@ Rails/UnknownEnv:
|
||||
Exclude:
|
||||
- 'app/models/spree/app_configuration.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# Configuration parameters: Severity.
|
||||
Rails/UnusedRenderContent:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/bulk_line_items_controller.rb'
|
||||
- 'app/controllers/admin/tag_rules_controller.rb'
|
||||
- 'app/controllers/api/v0/enterprise_fees_controller.rb'
|
||||
- 'app/controllers/api/v0/products_controller.rb'
|
||||
- 'app/controllers/api/v0/taxons_controller.rb'
|
||||
- 'app/controllers/api/v0/variants_controller.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Security/Open:
|
||||
Exclude:
|
||||
|
||||
@@ -35,7 +35,7 @@ module Admin
|
||||
order.with_lock do
|
||||
if order.contents.update_item(@line_item, line_item_params)
|
||||
# No Content, does not trigger ng resource auto-update
|
||||
render body: nil, status: :no_content
|
||||
head :no_content
|
||||
else
|
||||
render json: { errors: @line_item.errors }, status: :precondition_failed
|
||||
end
|
||||
@@ -49,7 +49,7 @@ module Admin
|
||||
authorize! :update, order
|
||||
|
||||
order.contents.remove(@line_item.variant)
|
||||
render body: nil, status: :no_content # No Content, does not trigger ng resource auto-update
|
||||
head :no_content # No Content, does not trigger ng resource auto-update
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -5,7 +5,7 @@ module Admin
|
||||
respond_to :json
|
||||
|
||||
respond_override destroy: { json: {
|
||||
success: lambda { render body: nil, status: :no_content }
|
||||
success: lambda { head :no_content }
|
||||
} }
|
||||
|
||||
def map_by_tag
|
||||
|
||||
@@ -9,7 +9,7 @@ module Api
|
||||
authorize! :destroy, enterprise_fee
|
||||
|
||||
if enterprise_fee.destroy
|
||||
render plain: I18n.t(:successfully_removed), status: :no_content
|
||||
head :no_content
|
||||
else
|
||||
render plain: enterprise_fee.errors.full_messages.first, status: :forbidden
|
||||
end
|
||||
|
||||
@@ -44,7 +44,7 @@ module Api
|
||||
authorize! :delete, @product
|
||||
@product.destroyed_by = current_api_user
|
||||
@product.destroy
|
||||
render json: @product, serializer: Api::Admin::ProductSerializer, status: :no_content
|
||||
head :no_content
|
||||
end
|
||||
|
||||
def bulk_products
|
||||
|
||||
@@ -55,7 +55,7 @@ module Api
|
||||
def destroy
|
||||
authorize! :delete, Spree::Taxon
|
||||
taxon.destroy
|
||||
render json: taxon, serializer: Api::TaxonSerializer, status: :no_content
|
||||
head :no_content
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -44,7 +44,7 @@ module Api
|
||||
authorize! :delete, @variant
|
||||
|
||||
VariantDeleter.new.delete(@variant)
|
||||
render json: @variant, serializer: Api::VariantSerializer, status: :no_content
|
||||
head :no_content
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user