From 37c18ff3242a3e80673020de02d888c20a34c167 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Sun, 8 Nov 2020 14:27:13 +1100 Subject: [PATCH] Remove unused ExtraLocaleController extension --- extensions/extra_locales_controller.rb | 16 ------------ plugin.rb | 2 -- .../extra_locales_controller_spec.rb | 26 ------------------- 3 files changed, 44 deletions(-) delete mode 100644 extensions/extra_locales_controller.rb delete mode 100644 spec/extensions/extra_locales_controller_spec.rb diff --git a/extensions/extra_locales_controller.rb b/extensions/extra_locales_controller.rb deleted file mode 100644 index 31a9f488..00000000 --- a/extensions/extra_locales_controller.rb +++ /dev/null @@ -1,16 +0,0 @@ -module ExtraLocalesControllerCustomWizard - def show - if request.referer && URI(request.referer).path.include?('/w/') - bundle = params[:bundle] - - if params[:v]&.size == 32 - hash = ::ExtraLocalesController.bundle_js_hash(bundle) - immutable_for(1.year) if hash == params[:v] - end - - render plain: ::ExtraLocalesController.bundle_js(bundle), content_type: "application/javascript" - else - super - end - end -end \ No newline at end of file diff --git a/plugin.rb b/plugin.rb index 20df5a12..95608e6e 100644 --- a/plugin.rb +++ b/plugin.rb @@ -76,7 +76,6 @@ after_initialize do ../serializers/custom_wizard/wizard_step_serializer.rb ../serializers/custom_wizard/wizard_serializer.rb ../serializers/custom_wizard/log_serializer.rb - ../extensions/extra_locales_controller.rb ../extensions/invites_controller.rb ../extensions/users_controller.rb ../extensions/wizard_field.rb @@ -155,7 +154,6 @@ after_initialize do redirect_to_wizard_if_required if current_user end - ::ExtraLocalesController.prepend ExtraLocalesControllerCustomWizard ::InvitesController.prepend InvitesControllerCustomWizard ::UsersController.prepend CustomWizardUsersController ::Wizard::Field.prepend CustomWizardFieldExtension diff --git a/spec/extensions/extra_locales_controller_spec.rb b/spec/extensions/extra_locales_controller_spec.rb deleted file mode 100644 index e12b5f04..00000000 --- a/spec/extensions/extra_locales_controller_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'rails_helper' - -describe ExtraLocalesControllerCustomWizard, type: :request do - before do - CustomWizard::Template.save( - JSON.parse(File.open( - "#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/wizard.json" - ).read), - skip_jobs: true) - end - - before do - @controller = ExtraLocalesController.new - end - - it "returns locales when requested by wizard" do - @controller.request = ActionController::TestRequest.create(@controller.class) - @controller.request.env['HTTP_REFERER'] = "/w/super-mega-fun-wizard" - - expect( - ExtraLocalesController.url("wizard") - ).to eq( - "#{Discourse.base_path}/extra-locales/wizard?v=#{ExtraLocalesController.bundle_js_hash("wizard")}" - ) - end -end \ No newline at end of file