From ed496a45b4d44aba4fc493fc6cbfc0498547c50f Mon Sep 17 00:00:00 2001 From: Benoit Queyron Date: Thu, 6 Jun 2024 11:53:08 +0200 Subject: [PATCH 01/12] ajout du texte introductif du bouton JDMA dans merci --- app/assets/stylesheets/merci.scss | 7 ------- app/views/users/dossiers/_merci.html.haml | 6 +++++- config/locales/en.yml | 2 ++ config/locales/fr.yml | 2 ++ 4 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 app/assets/stylesheets/merci.scss diff --git a/app/assets/stylesheets/merci.scss b/app/assets/stylesheets/merci.scss deleted file mode 100644 index b73c2d8e655..00000000000 --- a/app/assets/stylesheets/merci.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import "constants"; - -.merci .monavis { - img { - margin-top: 2 * $default-padding; - } -} diff --git a/app/views/users/dossiers/_merci.html.haml b/app/views/users/dossiers/_merci.html.haml index 383f502d96e..12bd195f630 100644 --- a/app/views/users/dossiers/_merci.html.haml +++ b/app/views/users/dossiers/_merci.html.haml @@ -20,7 +20,11 @@ .flex.column.align-center = link_to t('views.users.dossiers.merci.acces_dossier'), dossier ? dossier_path(dossier) : "#dossier" , class: 'fr-btn fr-btn--xl fr-mt-5w' - = link_to t('views.users.dossiers.merci.submit_dossier'), commencer_url(procedure.path), class: 'fr-btn fr-btn--secondary fr-mt-3w' + = link_to t('views.users.dossiers.merci.submit_dossier'), commencer_url(procedure.path), class: 'fr-btn fr-btn--secondary fr-mt-3w fr-mb-2w' .monavis + %p.fr-mt-5w.fr-mb-1w + %strong= t('views.users.dossiers.merci.jdma_l1') + %p= t('views.users.dossiers.merci.jdma_l2') + != procedure.monavis_embed diff --git a/config/locales/en.yml b/config/locales/en.yml index b8413b1eb38..5787289e6a3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -446,6 +446,8 @@ en: dossier_edit_l4: talk with an instructor. acces_dossier: Access your file submit_dossier: Submit an other file + jdma_l1: Help us improve this service! + jdma_l2: Give us your feedback, it only takes 2 minutes. show: header: summary: "Summary" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 619f5f4f4f8..52100dc7873 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -449,6 +449,8 @@ fr: dossier_edit_l4: échanger avec un instructeur. acces_dossier: Accéder à votre dossier submit_dossier: Déposer un autre dossier + jdma_l1: Aidez-nous à améliorer ce service ! + jdma_l2: Donnez-nous votre avis, cela ne prend que 2 minutes. show: header: summary: "Résumé" From f106e558c058a9ca48f93e9599bf4448e2b5bfa7 Mon Sep 17 00:00:00 2001 From: Benoit Queyron Date: Fri, 7 Jun 2024 12:25:30 +0200 Subject: [PATCH 02/12] pour le site nb_source=site --- app/views/users/dossiers/_merci.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/dossiers/_merci.html.haml b/app/views/users/dossiers/_merci.html.haml index 12bd195f630..9081ee58a64 100644 --- a/app/views/users/dossiers/_merci.html.haml +++ b/app/views/users/dossiers/_merci.html.haml @@ -27,4 +27,4 @@ %strong= t('views.users.dossiers.merci.jdma_l1') %p= t('views.users.dossiers.merci.jdma_l2') - != procedure.monavis_embed + != procedure.monavis_embed.gsub('nd_source=button', 'nd_source=site') From 0f1c1302a9dff0a354d69809fcf41e587a1ab2f1 Mon Sep 17 00:00:00 2001 From: Benoit Queyron Date: Fri, 7 Jun 2024 12:32:55 +0200 Subject: [PATCH 03/12] =?UTF-8?q?on=20affiche=20uniquement=20si=20JDMA=20a?= =?UTF-8?q?ctiv=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/dossiers/_merci.html.haml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/users/dossiers/_merci.html.haml b/app/views/users/dossiers/_merci.html.haml index 9081ee58a64..955f7fdf81f 100644 --- a/app/views/users/dossiers/_merci.html.haml +++ b/app/views/users/dossiers/_merci.html.haml @@ -22,9 +22,9 @@ = link_to t('views.users.dossiers.merci.acces_dossier'), dossier ? dossier_path(dossier) : "#dossier" , class: 'fr-btn fr-btn--xl fr-mt-5w' = link_to t('views.users.dossiers.merci.submit_dossier'), commencer_url(procedure.path), class: 'fr-btn fr-btn--secondary fr-mt-3w fr-mb-2w' - .monavis - %p.fr-mt-5w.fr-mb-1w - %strong= t('views.users.dossiers.merci.jdma_l1') - %p= t('views.users.dossiers.merci.jdma_l2') - - != procedure.monavis_embed.gsub('nd_source=button', 'nd_source=site') + - if procedure.monavis_embed + .monavis + %p.fr-mt-5w.fr-mb-1w + %strong= t('views.users.dossiers.merci.jdma_l1') + %p= t('views.users.dossiers.merci.jdma_l2') + != procedure.monavis_embed.gsub('nd_source=button', 'nd_source=site') From a9b56459c83eb2611e309839d899a16e612349cf Mon Sep 17 00:00:00 2001 From: Benoit Queyron Date: Fri, 7 Jun 2024 12:52:27 +0200 Subject: [PATCH 04/12] on fait ouvrir dans un nouvel onglet --- app/views/users/dossiers/_merci.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/dossiers/_merci.html.haml b/app/views/users/dossiers/_merci.html.haml index 955f7fdf81f..c25957a48a2 100644 --- a/app/views/users/dossiers/_merci.html.haml +++ b/app/views/users/dossiers/_merci.html.haml @@ -27,4 +27,4 @@ %p.fr-mt-5w.fr-mb-1w %strong= t('views.users.dossiers.merci.jdma_l1') %p= t('views.users.dossiers.merci.jdma_l2') - != procedure.monavis_embed.gsub('nd_source=button', 'nd_source=site') + != procedure.monavis_embed.gsub('nd_source=button', 'nd_source=site').gsub(' Date: Fri, 7 Jun 2024 18:20:28 +0200 Subject: [PATCH 05/12] ajout du JDMA au mail de depot de dossier (avec nb_source=email) --- app/mailers/notification_mailer.rb | 7 +++++++ app/views/layouts/mailers/_jdma.html.haml | 10 ++++++++++ .../notification_mailer/send_notification.html.haml | 3 +++ 3 files changed, 20 insertions(+) create mode 100644 app/views/layouts/mailers/_jdma.html.haml diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 4459e741dda..276c489111b 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -8,6 +8,7 @@ class NotificationMailer < ApplicationMailer before_action :set_dossier, except: [:send_notification_for_tiers, :send_accuse_lecture_notification] before_action :set_services_publics_plus, only: :send_notification + before_action :set_jdma, only: :send_notification helper ServiceHelper helper MailerHelper @@ -88,6 +89,12 @@ def set_services_publics_plus @services_publics_plus_url = ENV['SERVICES_PUBLICS_PLUS_URL'].presence end + def set_jdma + return unless params[:state] == Dossier.states.fetch(:en_construction) + + @jdma_html = @dossier.procedure.monavis_embed.presence + end + def set_dossier @dossier = params[:dossier] configure_defaults_for_user(@dossier.user) diff --git a/app/views/layouts/mailers/_jdma.html.haml b/app/views/layouts/mailers/_jdma.html.haml new file mode 100644 index 00000000000..e88cd4dc25b --- /dev/null +++ b/app/views/layouts/mailers/_jdma.html.haml @@ -0,0 +1,10 @@ += vertical_margin(50) + +%div{ align: "center" } + %p + %strong Aidez-nous à améliorer ce service ! + %br + Donnez-nous votre avis, cela ne prend que 2 minutes. + != @jdma_html.gsub('nd_source=button', 'nd_source=email').gsub(' Date: Mon, 10 Jun 2024 11:09:55 +0200 Subject: [PATCH 06/12] ajout d'un helper pour la source --- app/mailers/notification_mailer.rb | 2 +- app/models/procedure.rb | 4 ++++ app/views/layouts/mailers/_jdma.html.haml | 2 +- app/views/users/dossiers/_merci.html.haml | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 276c489111b..9b0d94493ff 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -92,7 +92,7 @@ def set_services_publics_plus def set_jdma return unless params[:state] == Dossier.states.fetch(:en_construction) - @jdma_html = @dossier.procedure.monavis_embed.presence + @jdma_html = @dossier.procedure.monavis_embed_html_source("email").presence end def set_dossier diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 11cec13d892..337970e89cb 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -1008,6 +1008,10 @@ def reset_closing_params update!(closing_reason: nil, closing_details: nil, replaced_by_procedure_id: nil, closing_notification_brouillon: false, closing_notification_en_cours: false) end + def monavis_embed_html_source(source) + monavis_embed.gsub('nd_source=button', "nd_source=#{source}").gsub(' Date: Mon, 10 Jun 2024 11:26:37 +0200 Subject: [PATCH 07/12] fix(brakeman): maj avec le nouvel appel dans la vue --- config/brakeman.ignore | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/brakeman.ignore b/config/brakeman.ignore index bf9b76294ae..7dd6545daf7 100644 --- a/config/brakeman.ignore +++ b/config/brakeman.ignore @@ -3,19 +3,19 @@ { "warning_type": "Cross-Site Scripting", "warning_code": 2, - "fingerprint": "1b805585567775589825c0eda58cb84c074fc760d0a7afb101c023a51427f2b5", + "fingerprint": "26f504696b074d18ef3f5568dc8f6a46d1283a67fe37822498fa25d0409664ab", "check_name": "CrossSiteScripting", "message": "Unescaped model attribute", "file": "app/views/users/dossiers/_merci.html.haml", - "line": 26, + "line": 30, "link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting", - "code": "current_user.dossiers.includes(:procedure).find(params[:id]).procedure.monavis_embed", + "code": "current_user.dossiers.includes(:procedure).find(params[:id]).procedure.monavis_embed_html_source(\"site\")", "render_path": [ { "type": "controller", "class": "Users::DossiersController", "method": "merci", - "line": 309, + "line": 320, "file": "app/controllers/users/dossiers_controller.rb", "rendered": { "name": "users/dossiers/merci", @@ -74,7 +74,7 @@ "check_name": "CrossSiteScripting", "message": "Unescaped parameter value", "file": "app/views/faq/show.html.haml", - "line": 12, + "line": 13, "link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting", "code": "Redcarpet::Markdown.new(Redcarpet::TrustedRenderer.new(view_context), :autolink => true).render(loader_service.find(\"#{params[:category]}/#{params[:slug]}\").content)", "render_path": [ @@ -203,6 +203,6 @@ "note": "Current is not a model" } ], - "updated": "2024-04-23 18:27:12 +0200", + "updated": "2024-06-10 11:21:19 +0200", "brakeman_version": "6.1.2" } From ef2a02197147b3ecc7fc957dfce70833df0bebdd Mon Sep 17 00:00:00 2001 From: Benoit Queyron Date: Mon, 10 Jun 2024 13:06:54 +0200 Subject: [PATCH 08/12] fix condition si monavis est nil --- .DS_Store | Bin 0 -> 8196 bytes app/mailers/notification_mailer.rb | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..765f57dc5914c412cd52c3818b1a7cf891808d37 GIT binary patch literal 8196 zcmeHMT~8ZF6un~;yq19)wUKyc@<=d)K??%$+%N?~G?nM5;0Fd`z@LL=g_Q z)e25Ig`e{=QwrwJJy-=kWryt~YvWsW1{-b!1%d)WfuKN8ASm$9PylN-m*|FdUq21! zpg>UIf2jb^4>cTY>&8yBm8kgct$0#WNNws->Y;x1P-UPp8qko|XoRa%N?eAzlfxKO3VZ_mA)Qd$WBlwfDnMn_p|037 zFkk2R`O{;~3p%Bj=*5xip>X73%QhDE4`}Q%h}HSUQs)EOrpNS%4rrhDs6kI~wTJHy z!9Jyq$7a=Rc4T_eg{PQ~sO#cIGaFw(@AFi$F-2gYr&klJVxyL!M+`+09$R>BVdVOv ztRBHvG;(VYt?U{~=wlasWL*=#<*buhvUFN-(buEydLby}@XFwg(b55WmFtN$au`MF zQ;tdwszP64oVIBfW7Wi&qjsjx3aU9Qt~<+%A_uhqMRlCEpbuY-Ss@yFePxZ_I2!fQ zQ_cj51+?i0j7pZ5dk(LJk&Ds(Lpq-IBKp`~mVwStFXM;!tVs--{Lnt#b}Hnd<8Oh! z#&~efnh^nuv+~U2v3j=Wd3YXUp5U1C;*+Dx!7kZYX(4;a&3K8mKP(+1LA#bB*r$23d*ORaD}!pE5BugF?r-gW(i@J}*MC=q;@qwIQdEj6 z(Ra<`?7TUON8@259z5r72U(W1r`K`&X|H?Us(!ScrK7l)b_YV}b-I9j`>dCCvhzkZ zPCG;4HuZz39F<$um5Ymw&(>FKTbrAgtF?=*PjLNUDl^J#5jT+`12fGAp51u$m zd7Zk>D0ug{Xsg4mUU4}u|DKP`a`;mX-pv*@Y^4Ibd-MDMcdIO*f&xK-f29IyZl}4^ zK+~sFs^1IVYu9kRz`=!a6K#cplWfOfWjhXg^@ky@Yk)GRZtO%`+(CKoF9NRrq2%9~ X_DUJn|9)8i<^2;P!&z7VgX{lalf>_= literal 0 HcmV?d00001 diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 9b0d94493ff..3e606438996 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -90,9 +90,9 @@ def set_services_publics_plus end def set_jdma - return unless params[:state] == Dossier.states.fetch(:en_construction) + return unless params[:state] == Dossier.states.fetch(:en_construction) && @dossier.procedure.monavis_embed - @jdma_html = @dossier.procedure.monavis_embed_html_source("email").presence + @jdma_html = @dossier.procedure.monavis_embed_html_source("email") end def set_dossier From c5fa25ee78f6f7f208389ec4f35ecb09a9f10891 Mon Sep 17 00:00:00 2001 From: Benoit Queyron Date: Tue, 11 Jun 2024 17:45:51 +0200 Subject: [PATCH 09/12] unless to if condition --- app/mailers/notification_mailer.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 9b0d94493ff..c319df7dd36 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -90,9 +90,11 @@ def set_services_publics_plus end def set_jdma - return unless params[:state] == Dossier.states.fetch(:en_construction) - - @jdma_html = @dossier.procedure.monavis_embed_html_source("email").presence + if params[:state] == Dossier.states.fetch(:en_construction) && @dossier.procedure.monavis_embed + @jdma_html = @dossier.procedure.monavis_embed_html_source("email") + else + return + end end def set_dossier From 98782f8bf01328a37ea772e6a3b705344cd0a125 Mon Sep 17 00:00:00 2001 From: Benoit Queyron <72251526+Benoit-MINT@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:37:05 +0200 Subject: [PATCH 10/12] suggestion de Colin Co-authored-by: Colin Darie --- app/mailers/notification_mailer.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index c319df7dd36..e64a68ddcad 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -92,11 +92,8 @@ def set_services_publics_plus def set_jdma if params[:state] == Dossier.states.fetch(:en_construction) && @dossier.procedure.monavis_embed @jdma_html = @dossier.procedure.monavis_embed_html_source("email") - else - return end end - def set_dossier @dossier = params[:dossier] configure_defaults_for_user(@dossier.user) From cf787d322a274ff9f6d05250ebf4b4fa1d319289 Mon Sep 17 00:00:00 2001 From: Benoit Queyron <72251526+Benoit-MINT@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:43:13 +0200 Subject: [PATCH 11/12] linter check --- app/mailers/notification_mailer.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index e64a68ddcad..87d75fa1cb2 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -94,6 +94,7 @@ def set_jdma @jdma_html = @dossier.procedure.monavis_embed_html_source("email") end end + def set_dossier @dossier = params[:dossier] configure_defaults_for_user(@dossier.user) From ee35dba37efdb00f2a19776989e41c478972aaeb Mon Sep 17 00:00:00 2001 From: Benoit Queyron Date: Fri, 14 Jun 2024 18:04:16 +0200 Subject: [PATCH 12/12] linter check --- app/mailers/notification_mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 87d75fa1cb2..8aa68de199d 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -94,7 +94,7 @@ def set_jdma @jdma_html = @dossier.procedure.monavis_embed_html_source("email") end end - + def set_dossier @dossier = params[:dossier] configure_defaults_for_user(@dossier.user)