Merge pull request #7643 from betagouv/fix-contact-captcha

fix: contact captcha invisibility, view_component update
This commit is contained in:
Colin Darie 2022-08-03 12:03:17 +02:00 committed by GitHub
commit b446e4867f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 9 additions and 12 deletions

View file

@ -727,7 +727,7 @@ GEM
rails (>= 6.0.0)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.4)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
@ -741,7 +741,7 @@ GEM
activemodel (>= 3.0.0)
public_suffix
vcr (6.1.0)
view_component (2.53.0)
view_component (2.63.0)
activesupport (>= 5.0.0, < 8.0)
method_source (~> 1.0)
virtus (2.0.0)

View file

@ -1,5 +1,5 @@
.flex.justify-start.section{ id: dom_id(@tdc.stable_self, :conditions) }
= form_with url: admin_procedure_condition_path(@procedure_id, @tdc.stable_id), method: :patch, class: 'form width-100' do |f|
= form_tag admin_procedure_condition_path(@procedure_id, @tdc.stable_id), method: :patch, class: 'form width-100' do
.conditionnel.mt-2.width-100
.flex
%p.mr-2 Logique conditionnelle

View file

@ -96,6 +96,6 @@ class SupportController < ApplicationController
end
def redirect_to_root
redirect_to root_path, alert: t('invisible_captcha.custom_message')
redirect_to root_path, alert: t('invisible_captcha.sentence_for_humans')
end
end

View file

@ -26,8 +26,6 @@
= t('.your_question')
= hidden_field_tag :type, params[:type]
= invisible_captcha
%dl
- @options.each do |(question, question_type, link)|
%dt
@ -71,5 +69,7 @@
= hidden_field_tag :tags, @tags&.join(',')
= invisible_captcha
.send-wrapper
= button_tag t('send_mail', scope: [:utils]), type: :submit, class: 'button send primary'

View file

@ -88,8 +88,5 @@ module TPS
config.view_component.show_previews_source = true
config.view_component.default_preview_layout = 'component_preview'
config.view_component.preview_paths << "#{Rails.root}/spec/components/previews"
# see: https://viewcomponent.org/known_issues.html
config.view_component.use_global_output_buffer = true
end
end

View file

@ -31,7 +31,7 @@
en:
invisible_captcha:
custom_message: 'If you are a human, ignore this field'
sentence_for_humans: 'If you are a human, ignore this field'
help: 'Help'
help_dropdown:

View file

@ -21,7 +21,7 @@
fr:
invisible_captcha:
custom_message: 'Si vous êtes un humain, veuillez ignorer ce champs'
sentence_for_humans: 'Si vous êtes un humain, laissez ce champ vide'
help: 'Aide'
help_dropdown:
problem_title: Un problème avec le site ?

View file

@ -122,7 +122,7 @@ describe SupportController, type: :controller do
let(:params) { { subject: 'bonjour', text: 'un message', InvisibleCaptcha.honeypots.sample => 'boom' } }
it 'does not create a conversation on HelpScout' do
expect { subject }.not_to change(Commentaire, :count)
expect(flash[:alert]).to eq(I18n.t('invisible_captcha.custom_message'))
expect(flash[:alert]).to eq(I18n.t('invisible_captcha.sentence_for_humans'))
end
end
end