A platform for community discussion. Free, open, simple.
DEV: Manually fix Rails/UnusedRenderContent offenses (#34418)
Jarek Radosz2c4e3d6d47f0
diff --git a/app/controllers/admin/themes_controller.rb b/app/controllers/admin/themes_controller.rbindex 0541eed77cb..c1a0e85a8d5 100644--- a/app/controllers/admin/themes_controller.rb+++ b/app/controllers/admin/themes_controller.rb@@ -290,7 +290,7 @@ class Admin::ThemesController < Admin::AdminControllerdef destroyThemes::Destroy.call(service_params) do- on_success { render json: {}, status: :no_content }+ on_success { head :no_content }on_failed_contract do |contract|render json: failed_json.merge(errors: contract.errors.full_messages), status: 400end@@ -300,7 +300,7 @@ class Admin::ThemesController < Admin::AdminControllerdef bulk_destroyThemes::BulkDestroy.call(service_params) do- on_success { render json: {}, status: :no_content }+ on_success { head :no_content }on_failed_contract do |contract|render json: failed_json.merge(errors: contract.errors.full_messages), status: 400enddiff --git a/app/controllers/stylesheets_controller.rb b/app/controllers/stylesheets_controller.rbindex 457b2b08a71..342fe1e7d58 100644--- a/app/controllers/stylesheets_controller.rb+++ b/app/controllers/stylesheets_controller.rb@@ -72,7 +72,7 @@ class StylesheetsController < ApplicationControllerhandle_missing_cache(location, target, digest) if !stylesheet_timeif cache_time.present? && stylesheet_time && stylesheet_time <= cache_time- return render body: nil, status: 304+ return head :not_modifiedendunless File.exist?(location)diff --git a/app/controllers/theme_javascripts_controller.rb b/app/controllers/theme_javascripts_controller.rbindex 087f127b13a..3fa589d55ac 100644--- a/app/controllers/theme_javascripts_controller.rb+++ b/app/controllers/theme_javascripts_controller.rb@@ -17,7 +17,7 @@ class ThemeJavascriptsController < ApplicationControllerdef showraise Discourse::NotFound if last_modified.blank?- return render body: nil, status: 304 if not_modified?+ return head :not_modified if not_modified?# Security: safe due to route constraintcache_file = "#{DISK_CACHE_PATH}/#{params[:digest]}.js"@@ -36,7 +36,7 @@ class ThemeJavascriptsController < ApplicationControllerdef show_mapraise Discourse::NotFound if last_modified.blank?- return render body: nil, status: 304 if not_modified?+ return head :not_modified if not_modified?# Security: safe due to route constraintcache_file = "#{DISK_CACHE_PATH}/#{params[:digest]}.map"@@ -57,7 +57,7 @@ class ThemeJavascriptsController < ApplicationControllerraise Discourse::NotFound if content.blank? || content_digest != digest@cache_file = "#{TESTS_DISK_CACHE_PATH}/#{digest}.js"- return render body: nil, status: 304 if not_modified?+ return head :not_modified if not_modified?write_if_not_cached(@cache_file) { content }diff --git a/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/sync_controller.rb b/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/sync_controller.rbindex 4d9570b9b6c..8e95839a0e1 100644--- a/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/sync_controller.rb+++ b/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/sync_controller.rb@@ -40,7 +40,7 @@ module DiscourseZendeskPluginendend- render json: {}, status: 204+ head :no_contentendprivate