From 9bec007dfa4b7523a7e4932f1ce563d9812fc65a Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Wed, 13 Nov 2024 18:13:56 +0100 Subject: [PATCH] refactor(download): remove useless turbo of menu since it's not dynamic anymore --- app/controllers/instructeurs/procedures_controller.rb | 5 ----- .../administrateurs/exports/download.turbo_stream.haml | 5 +---- .../procedures/download_export.turbo_stream.haml | 9 --------- .../administrateurs/exports_controller_spec.rb | 1 - 4 files changed, 1 insertion(+), 19 deletions(-) diff --git a/app/controllers/instructeurs/procedures_controller.rb b/app/controllers/instructeurs/procedures_controller.rb index 4aababff6..e7772b88e 100644 --- a/app/controllers/instructeurs/procedures_controller.rb +++ b/app/controllers/instructeurs/procedures_controller.rb @@ -137,11 +137,6 @@ module Instructeurs .groupe_instructeurs .where(procedure: procedure) - @can_download_dossiers = current_instructeur - .dossiers - .visible_by_administration - .exists?(groupe_instructeur_id: groupe_instructeur_ids) && !instructeur_as_manager? - export = Export.find_or_create_fresh_export(export_format, groupe_instructeurs, current_instructeur, **export_options) @procedure = procedure diff --git a/app/views/administrateurs/exports/download.turbo_stream.haml b/app/views/administrateurs/exports/download.turbo_stream.haml index 6db447783..c7fdcb17d 100644 --- a/app/views/administrateurs/exports/download.turbo_stream.haml +++ b/app/views/administrateurs/exports/download.turbo_stream.haml @@ -1,4 +1 @@ --# not renderable as administrateur flagged as manager, so render it anyway -- if @can_download_dossiers - = turbo_stream.update_all '.procedure-actions' do - = render Dossiers::ExportDropdownComponent.new(procedure: @procedure, count: @dossiers_count, export_url: method(:admin_procedure_exports_path)) +-# empty file so notice are still rendered diff --git a/app/views/instructeurs/procedures/download_export.turbo_stream.haml b/app/views/instructeurs/procedures/download_export.turbo_stream.haml index c6e47b799..68e1f096c 100644 --- a/app/views/instructeurs/procedures/download_export.turbo_stream.haml +++ b/app/views/instructeurs/procedures/download_export.turbo_stream.haml @@ -1,11 +1,2 @@ --# not renderable as instructeur flagged as manager, so render it anyway -- if @can_download_dossiers - - if @statut.nil? - = turbo_stream.update_all '.procedure-actions' do - = render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_templates: current_instructeur.export_templates_for(@procedure), export_url: method(:download_export_instructeur_procedure_path)) - - else - = turbo_stream.update_all '.dossiers-export' do - = render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_templates: current_instructeur.export_templates_for(@procedure), statut: @statut, count: @dossiers_count, export_url: method(:download_export_instructeur_procedure_path)) - = turbo_stream.update "last-export-alert" do = render partial: "last_export_alert", locals: { export: @last_export, statut: @statut } diff --git a/spec/controllers/administrateurs/exports_controller_spec.rb b/spec/controllers/administrateurs/exports_controller_spec.rb index 5ec1a4962..bf128ee17 100644 --- a/spec/controllers/administrateurs/exports_controller_spec.rb +++ b/spec/controllers/administrateurs/exports_controller_spec.rb @@ -59,7 +59,6 @@ describe Administrateurs::ExportsController, type: :controller do end it 'responds in the correct format' do - expect(response.media_type).to eq('text/vnd.turbo-stream.html') expect(response).to have_http_status(:ok) end end