Merge pull request #5649 from betagouv/dev

2020-09-30-01
This commit is contained in:
Keirua 2020-09-30 10:48:44 +02:00 committed by GitHub
commit ee9c47571f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 33 additions and 20 deletions

View file

@ -5,6 +5,7 @@ version: 2
updates:
- package-ecosystem: "bundler"
directory: "/" # Location of package manifests
open-pull-requests-limit: 0 # disabled for now
schedule:
interval: "daily"

View file

@ -237,13 +237,13 @@ GEM
ffi (1.13.1)
ffi-geos (2.1.0)
ffi (>= 1.0.0)
flipper (0.18.0)
flipper-active_record (0.18.0)
flipper (0.19.0)
flipper-active_record (0.19.0)
activerecord (>= 5.0, < 7)
flipper (~> 0.18.0)
flipper-ui (0.18.0)
flipper (~> 0.19.0)
flipper-ui (0.19.0)
erubi (>= 1.0.0, < 2.0.0)
flipper (~> 0.18.0)
flipper (~> 0.19.0)
rack (>= 1.4, < 3)
rack-protection (>= 1.5.3, < 2.1.0)
fog-core (2.2.0)
@ -268,7 +268,7 @@ GEM
geocoder (1.6.3)
globalid (0.4.2)
activesupport (>= 4.2.0)
gon (6.3.2)
gon (6.4.0)
actionpack (>= 3.0.20)
i18n (>= 0.7)
multi_json
@ -739,7 +739,7 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webpacker (5.1.1)
webpacker (5.2.1)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)

View file

@ -15,12 +15,7 @@ class InvitesController < ApplicationController
)
if invite.valid?
if invite.user.present?
InviteMailer.invite_user(invite).deliver_later
else
InviteMailer.invite_guest(invite).deliver_later
end
# The notification is sent through an after commit hook in order to avoir concurrency issues
flash.notice = "Une invitation a été envoyée à #{invite.email}."
else
flash.alert = invite.errors.full_messages

View file

@ -54,6 +54,7 @@ module NewAdministrateur
def show
@procedure = current_administrateur.procedures.find(params[:id])
@current_administrateur = current_administrateur
if @procedure.brouillon?
@procedure_lien = commencer_test_url(path: @procedure.path)
else

View file

@ -308,7 +308,7 @@ class Dossier < ApplicationRecord
after_save :send_dossier_received
after_save :send_web_hook
after_create :send_draft_notification_email
after_create_commit :send_draft_notification_email
validates :user, presence: true
validates :individual, presence: true, if: -> { revision.procedure.for_individual? }

View file

@ -19,6 +19,8 @@ class Invite < ApplicationRecord
before_validation -> { sanitize_email(:email) }
after_create_commit :send_notification
validates :email, presence: true
validates :email, uniqueness: { scope: :dossier_id }
@ -32,4 +34,12 @@ class Invite < ApplicationRecord
scope :kept, -> { joins(:dossier).merge(Dossier.kept) }
default_scope { kept }
def send_notification
if self.user.present?
InviteMailer.invite_user(self).deliver_later
else
InviteMailer.invite_guest(self).deliver_later
end
end
end

View file

@ -73,9 +73,11 @@ class ProcedureExportService
{ instances: table.last, sheet_name: table.first }
end.merge(DEFAULT_STYLES)
# transliterate: convert to ASCII characteres
# transliterate: convert to ASCII characters
# to ensure truncate respects 30 bytes
options[:sheet_name] = I18n.transliterate(options[:sheet_name], '')
# /\*?[] are invalid Excel worksheet characters
options[:sheet_name] = I18n.transliterate(options[:sheet_name], '', locale: :en)
.delete('/\*?[]')
.truncate(30, omission: '')
options

View file

@ -76,8 +76,8 @@
- else
Choix du service administratif
.card-admin-action
- if @procedure.service_id.present?
= link_to 'Modifier', edit_admin_service_path(@procedure.service, procedure_id: @procedure.id), class: 'button'
- if @procedure.service_id.blank? && current_administrateur.services.present?
= link_to 'Modifier', admin_services_path(procedure_id: @procedure.id), class: 'button'
- else
= link_to 'Remplir', new_admin_service_path(procedure_id: @procedure.id), class: 'button'

View file

@ -4,7 +4,10 @@
{ required: champ.mandatory? },
{ data: { secondary_options: champ.secondary_options } }
%span
= form.label :secondary_value, "Valeur secondaire dépendant de la première", class: 'hidden'
= form.label :secondary_value, class: 'hidden' do
Valeur secondaire dépendant de la première
- if champ.mandatory?
%span.mandatory *
= form.select :secondary_value,
champ.secondary_options[champ.primary_value],
{ required: champ.mandatory? },

View file

@ -359,7 +359,7 @@ describe ProcedureExportService do
context 'with long libelle composed of utf8 characteres' do
before do
procedure.types_de_champ.each do |c|
c.update!(libelle: "#{c.id} - éééé ééé ééé ééééééé ééééééé ééééééé éééééééé. ééé éé éééééééé éé ééé. ééééé éééééééé ééé ééé.")
c.update!(libelle: "#{c.id} - ?/[] ééé ééé ééééééé ééééééé éééééééé. ééé éé éééééééé éé ééé. ééééé éééééééé ééé ééé.")
end
champ_repetition.champs.each do |c|
c.type_de_champ.update!(libelle: "#{c.id} - Quam rem nam maiores numquam dolorem nesciunt. Cum et possimus et aut. Fugit voluptas qui qui.")

View file

@ -5,6 +5,7 @@ describe 'new_administrateur/procedures/show.html.haml', type: :view do
before do
assign(:procedure, procedure)
assign(:procedure_lien, commencer_url(path: procedure.path))
allow(view).to receive(:current_administrateur).and_return(procedure.administrateurs.first)
end
describe 'procedure is draft' do