Merge pull request #8736 from adullact/feat/rails-7

Tech: migration vers Rails 7
This commit is contained in:
Colin Darie 2023-05-04 07:03:06 +00:00 committed by GitHub
commit f4ccc5c717
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
98 changed files with 698 additions and 552 deletions

View file

@ -11,7 +11,7 @@ inherit_mode:
- Include
AllCops:
TargetRubyVersion: 3.1
TargetRubyVersion: 3.2
DisabledByDefault: true
SuggestExtensions: false
NewCops: enable

View file

@ -1 +1 @@
3.1.2
3.2.2

View file

@ -1,5 +1,7 @@
source 'https://rubygems.org'
gem 'rails', '~> 7.0.4' # allows update to security fixes at any time
gem 'aasm'
gem 'acsv'
gem 'active_link_to' # Automatically set a class on active links
@ -67,7 +69,6 @@ gem 'premailer-rails'
gem 'puma' # Use Puma as the app server
gem 'pundit'
gem 'rack-attack'
gem 'rails'
gem 'rails-i18n' # Locales par défaut
gem 'rake-progressbar', require: false
gem 'redcarpet'

View file

@ -4,40 +4,47 @@ GEM
aasm (5.2.0)
concurrent-ruby (~> 1.0)
acsv (0.0.1)
actioncable (6.1.7.1)
actionpack (= 6.1.7.1)
activesupport (= 6.1.7.1)
actioncable (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.1)
actionpack (= 6.1.7.1)
activejob (= 6.1.7.1)
activerecord (= 6.1.7.1)
activestorage (= 6.1.7.1)
activesupport (= 6.1.7.1)
actionmailbox (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (>= 2.7.1)
actionmailer (6.1.7.1)
actionpack (= 6.1.7.1)
actionview (= 6.1.7.1)
activejob (= 6.1.7.1)
activesupport (= 6.1.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.4.3)
actionpack (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (6.1.7.1)
actionview (= 6.1.7.1)
activesupport (= 6.1.7.1)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.4.3)
actionview (= 7.0.4.3)
activesupport (= 7.0.4.3)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.1)
actionpack (= 6.1.7.1)
activerecord (= 6.1.7.1)
activestorage (= 6.1.7.1)
activesupport (= 6.1.7.1)
actiontext (7.0.4.3)
actionpack (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.7.1)
activesupport (= 6.1.7.1)
actionview (7.0.4.3)
activesupport (= 7.0.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
@ -45,9 +52,9 @@ GEM
active_link_to (1.0.5)
actionpack
addressable
active_model_serializers (0.10.12)
actionpack (>= 4.1, < 6.2)
activemodel (>= 4.1, < 6.2)
active_model_serializers (0.10.13)
actionpack (>= 4.1, < 7.1)
activemodel (>= 4.1, < 7.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
active_storage_validations (0.9.6)
@ -55,31 +62,30 @@ GEM
activemodel (>= 5.2.0)
activestorage (>= 5.2.0)
activesupport (>= 5.2.0)
activejob (6.1.7.1)
activesupport (= 6.1.7.1)
activejob (7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.3.6)
activemodel (6.1.7.1)
activesupport (= 6.1.7.1)
activerecord (6.1.7.1)
activemodel (= 6.1.7.1)
activesupport (= 6.1.7.1)
activestorage (6.1.7.1)
actionpack (= 6.1.7.1)
activejob (= 6.1.7.1)
activerecord (= 6.1.7.1)
activesupport (= 6.1.7.1)
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activerecord (7.0.4.3)
activemodel (= 7.0.4.3)
activesupport (= 7.0.4.3)
activestorage (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activesupport (= 7.0.4.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activestorage-openstack (1.5.1)
fog-openstack (~> 1.0)
marcel
rails (>= 5.2.2)
activesupport (6.1.7.1)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
administrate (0.18.0)
@ -95,12 +101,10 @@ GEM
aes_key_wrap (1.1.0)
after_party (1.11.2)
anchored (1.1.0)
annotate (3.1.1)
activerecord (>= 3.2, < 7.0)
annotate (3.2.0)
activerecord (>= 3.2, < 8.0)
rake (>= 10.4, < 14.0)
ast (2.4.2)
attr_encrypted (3.1.0)
encryptor (~> 3.0.0)
attr_required (1.0.1)
axe-core-api (4.2.1)
capybara
@ -119,7 +123,7 @@ GEM
axlsx_styler (1.1.0)
activesupport (>= 3.1)
caxlsx (>= 2.0.2)
bcrypt (3.1.16)
bcrypt (3.1.18)
better_html (1.0.16)
actionview (>= 4.0)
activesupport (>= 4.0)
@ -175,14 +179,15 @@ GEM
css_parser (1.9.0)
addressable
daemons (1.3.1)
deep_cloneable (3.0.0)
activerecord (>= 3.1.0, < 7)
date (3.3.3)
deep_cloneable (3.2.0)
activerecord (>= 3.1.0, < 8)
delayed_cron_job (0.7.4)
delayed_job (>= 4.1)
delayed_job (4.1.11)
activesupport (>= 3.0, < 8.0)
delayed_job_active_record (4.1.5)
activerecord (>= 3.0, < 6.2)
delayed_job_active_record (4.1.7)
activerecord (>= 3.0, < 8.0)
delayed_job (>= 3.0, < 5)
delayed_job_web (1.4.4)
activerecord (> 3.0.0)
@ -191,7 +196,7 @@ GEM
sinatra (>= 1.4.4)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (4.7.3)
devise (4.9.2)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
@ -199,16 +204,14 @@ GEM
warden (~> 1.2.3)
devise-i18n (1.9.2)
devise (>= 4.7.1)
devise-two-factor (4.0.2)
activesupport (< 7.1)
attr_encrypted (>= 1.3, < 4, != 2)
devise-two-factor (5.0.0)
activesupport (~> 7.0)
devise (~> 4.0)
railties (< 7.1)
railties (~> 7.0)
rotp (~> 6.0)
diff-lcs (1.4.4)
digest (3.1.0)
discard (1.2.0)
activerecord (>= 4.2, < 7)
diff-lcs (1.5.0)
discard (1.2.1)
activerecord (>= 4.2, < 8)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
@ -224,7 +227,6 @@ GEM
concurrent-ruby (~> 1.0)
http (>= 3.0)
ruby2_keywords
encryptor (3.0.0)
erubi (1.12.0)
et-orbi (1.2.4)
tzinfo
@ -285,7 +287,7 @@ GEM
raabro (~> 1.4)
geo_coord (0.2.0)
geocoder (1.6.5)
globalid (1.0.1)
globalid (1.1.0)
activesupport (>= 5.0)
gon (6.4.0)
actionpack (>= 3.0.20)
@ -341,7 +343,7 @@ GEM
http-form_data (2.3.0)
http_accept_language (2.1.1)
httpclient (2.8.3)
i18n (1.12.0)
i18n (1.13.0)
concurrent-ruby (~> 1.0)
i18n-tasks (1.0.9)
activesupport (>= 4.0.2)
@ -362,7 +364,6 @@ GEM
ruby-vips (>= 2.0.17, < 3)
invisible_captcha (2.0.0)
rails (>= 5.0)
io-wait (0.2.1)
ipaddress (0.8.3)
jquery-rails (4.5.1)
rails-dom-testing (>= 1, < 3)
@ -412,10 +413,10 @@ GEM
railties (>= 4)
request_store (~> 1.0)
logstash-event (1.2.02)
loofah (2.19.1)
loofah (2.20.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.8.0.1)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
@ -436,28 +437,24 @@ GEM
rake
mini_magick (4.11.0)
mini_mime (1.1.2)
mini_portile2 (2.8.1)
mini_portile2 (2.8.2)
minitest (5.18.0)
msgpack (1.4.2)
multi_json (1.15.0)
multipart-post (2.1.1)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
net-imap (0.2.3)
digest
net-imap (0.3.4)
date
net-protocol
strscan
net-pop (0.1.1)
digest
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
timeout
net-protocol (0.1.1)
io-wait
timeout
net-smtp (0.2.1)
net-smtp (0.3.3)
net-protocol
netrc (0.11.0)
nio4r (2.5.8)
nio4r (2.5.9)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
@ -478,7 +475,7 @@ GEM
parser (3.2.2.0)
ast (~> 2.4.1)
pdf-core (0.9.0)
pg (1.2.3)
pg (1.4.6)
phonelib (0.6.53)
prawn (2.4.0)
pdf-core (~> 0.9.0)
@ -497,12 +494,12 @@ GEM
actionmailer (>= 3)
premailer (~> 1.7, >= 1.7.9)
promise.rb (0.7.4)
pry (0.13.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (~> 0.13.0)
pry (>= 0.13, < 0.15)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (5.0.1)
@ -512,7 +509,7 @@ GEM
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.6.2)
rack (2.2.6.4)
rack (2.2.7)
rack-attack (6.5.0)
rack (>= 1.0, < 3)
rack-mini-profiler (3.0.0)
@ -532,21 +529,20 @@ GEM
rack_session_access (0.2.0)
builder (>= 2.0.0)
rack (>= 1.0.0)
rails (6.1.7.1)
actioncable (= 6.1.7.1)
actionmailbox (= 6.1.7.1)
actionmailer (= 6.1.7.1)
actionpack (= 6.1.7.1)
actiontext (= 6.1.7.1)
actionview (= 6.1.7.1)
activejob (= 6.1.7.1)
activemodel (= 6.1.7.1)
activerecord (= 6.1.7.1)
activestorage (= 6.1.7.1)
activesupport (= 6.1.7.1)
rails (7.0.4.3)
actioncable (= 7.0.4.3)
actionmailbox (= 7.0.4.3)
actionmailer (= 7.0.4.3)
actionpack (= 7.0.4.3)
actiontext (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activemodel (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
bundler (>= 1.15.0)
railties (= 6.1.7.1)
sprockets-rails (>= 2.0.0)
railties (= 7.0.4.3)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
@ -564,12 +560,13 @@ GEM
rails-i18n (7.0.3)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (6.1.7.1)
actionpack (= 6.1.7.1)
activesupport (= 6.1.7.1)
railties (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
rake-progressbar (0.0.5)
@ -580,9 +577,9 @@ GEM
regexp_parser (2.8.0)
request_store (1.5.0)
rack (>= 1.4)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
responders (3.1.0)
actionpack (>= 5.2)
railties (>= 5.2)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
@ -596,29 +593,29 @@ GEM
builder (>= 3.0)
dry-inflector (~> 0.1)
rubyzip (>= 1.0)
rotp (6.2.0)
rotp (6.2.2)
rouge (3.30.0)
rqrcode (1.2.0)
chunky_png (~> 1.0)
rqrcode_core (~> 0.2)
rqrcode_core (0.2.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-rails (5.0.0)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (>= 5.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.10.2)
rspec-support (~> 3.12.0)
rspec-rails (6.0.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.11)
rspec-expectations (~> 3.11)
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.12.0)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.50.2)
@ -718,7 +715,7 @@ GEM
axlsx_styler (>= 1.0.0, < 2)
caxlsx (>= 2.0.2, < 4)
rodf (>= 1.0.0, < 2)
spring (2.1.1)
spring (4.1.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (4.2.0)
@ -731,7 +728,6 @@ GEM
stackprof (0.2.21)
strong_migrations (0.8.0)
activerecord (>= 5.2)
strscan (3.0.4)
swd (1.3.0)
activesupport (>= 3)
attr_required (>= 0.0.5)
@ -744,7 +740,7 @@ GEM
thread_safe (0.3.6)
tilt (2.0.11)
timecop (0.9.4)
timeout (0.1.1)
timeout (0.3.2)
ttfunk (1.7.0)
turbo-rails (1.3.2)
actionpack (>= 6.0.0)
@ -767,8 +763,9 @@ GEM
activemodel (>= 3.0.0)
public_suffix
vcr (6.1.0)
view_component (2.63.0)
activesupport (>= 5.0.0, < 8.0)
view_component (2.82.0)
activesupport (>= 5.2.0, < 8.0)
concurrent-ruby (~> 1.0)
method_source (~> 1.0)
virtus (2.0.0)
axiom-types (~> 0.1)
@ -815,7 +812,7 @@ GEM
nokogiri (~> 1.11)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.7)
zeitwerk (2.6.8)
zip_tricks (5.6.0)
zipline (1.4.1)
actionpack (>= 6.0, < 8.0)
@ -911,7 +908,7 @@ DEPENDENCIES
rack-attack
rack-mini-profiler
rack_session_access
rails
rails (~> 7.0.4)
rails-controller-testing
rails-erd
rails-i18n

View file

@ -93,7 +93,7 @@ class Attachment::EditComponent < ApplicationComponent
nil
end
def field_name
def field_name(object_name = nil, method_name = nil, *method_names, multiple: false, index: nil)
helpers.field_name(@form_object_name || ActiveModel::Naming.param_key(@attached_file.record), attribute_name)
end

View file

@ -11,7 +11,7 @@
- elsif export.available?
- menu.with_item do
%div
= link_to ready_link_label(export), export.file.service_url, target: "_blank", rel: "noopener", role: 'menuitem'
= link_to ready_link_label(export), export.file.url, target: "_blank", rel: "noopener", role: 'menuitem'
- if export.old?
= button_to download_export_path(export_format: export.format, force_export: true), refresh_button_options(export).merge(role: 'menuitem') do
.icon.retry

View file

@ -15,7 +15,7 @@ module Administrateurs
end
format.html do
redirect_to export.file.service_url
redirect_to url_from(export.file.url)
end
end
else

View file

@ -15,7 +15,7 @@ class AgentConnect::AgentController < ApplicationController
cookies.encrypted[STATE_COOKIE_NAME] = state
cookies.encrypted[NONCE_COOKIE_NAME] = nonce
redirect_to uri
redirect_to uri, allow_other_host: true
end
def callback

View file

@ -4,7 +4,7 @@ class FranceConnect::ParticulierController < ApplicationController
def login
if FranceConnectService.enabled?
redirect_to FranceConnectService.authorization_uri
redirect_to FranceConnectService.authorization_uri, allow_other_host: true
else
redirect_to new_user_session_path
end

View file

@ -19,7 +19,7 @@ module Instructeurs
def attestation
if dossier.attestation.pdf.attached?
redirect_to dossier.attestation.pdf.service_url
redirect_to dossier.attestation.pdf.url
end
end

View file

@ -175,7 +175,7 @@ module Instructeurs
end
format.html do
redirect_to export.file.service_url
redirect_to url_from(export.file.url)
end
end
else

View file

@ -73,7 +73,7 @@ module Users
def attestation
if dossier.attestation&.pdf&.attached?
redirect_to dossier.attestation.pdf.service_url
redirect_to dossier.attestation.pdf.url
else
flash.notice = t('.no_longer_available')
redirect_to dossier_path(dossier)

View file

@ -36,7 +36,7 @@ class Users::SessionsController < Devise::SessionsController
case connected_with_france_connect
when User.loged_in_with_france_connects.fetch(:particulier)
redirect_to FRANCE_CONNECT[:particulier][:logout_endpoint]
redirect_to FRANCE_CONNECT[:particulier][:logout_endpoint], allow_other_host: true
return
end
end

View file

@ -42,7 +42,10 @@ module Loaders
end
def preload_association(records)
::ActiveRecord::Associations::Preloader.new.preload(records, @association_schema)
::ActiveRecord::Associations::Preloader.new(
records: records,
associations: @association_schema
).call
end
def read_association(record)

View file

@ -11,7 +11,7 @@ module Types
if object.is_a?(Hash)
object[:url]
else
object.service_url
object.url
end
end
end

View file

@ -1,39 +0,0 @@
module FormTagHelper
# from Rails 7 ActionView::Helpers::FormTagHelper
# https://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-field_id
# Should be removed when we upgrade to Rails 7
def field_id(object_name, method_name, *suffixes, index: nil, namespace: nil)
if object_name.respond_to?(:model_name)
object_name = object_name.model_name.singular
end
sanitized_object_name = object_name.to_s.gsub(/\]\[|[^-a-zA-Z0-9:.]/, "_").delete_suffix("_")
sanitized_method_name = method_name.to_s.delete_suffix("?")
[
namespace,
sanitized_object_name.presence,
(index unless sanitized_object_name.empty?),
sanitized_method_name,
*suffixes
].tap(&:compact!).join("_")
end
# from Rails 7 ActionView::Helpers::FormTagHelper
# https://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-field_name
# Should be removed when we upgrade to Rails 7
def field_name(object_name, method_name, *method_names, multiple: false, index: nil)
names = method_names.map! { |name| "[#{name}]" }.join
# a little duplication to construct fewer strings
case
when object_name.blank?
"#{method_name}#{names}#{multiple ? "[]" : ""}"
when index
"#{object_name}[#{index}][#{method_name}]#{names}#{multiple ? "[]" : ""}"
else
"#{object_name}[#{method_name}]#{names}#{multiple ? "[]" : ""}"
end
end
end

View file

@ -5,7 +5,7 @@ class Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob < Cron::CronJob
def perform(*args)
gzip_filepath = [
'tmp/',
Time.zone.now.to_formatted_s(:number),
Time.zone.now.to_fs(:number),
'-demarches.json.gz'
].join

View file

@ -17,6 +17,7 @@
# etablissement_id :integer
# external_id :string
# parent_id :bigint
# row_id :string
# type_de_champ_id :integer
#
class Champs::BooleanChamp < Champ

View file

@ -55,7 +55,7 @@ class Champs::PieceJustificativeChamp < Champ
return nil if attachment.nil?
if attachment.virus_scanner.safe? || attachment.virus_scanner.pending?
attachment.service_url
attachment.url
end
end
end

View file

@ -13,12 +13,12 @@
# value_json :jsonb
# created_at :datetime
# updated_at :datetime
# dossier_id :integer not null
# dossier_id :integer
# etablissement_id :integer
# external_id :string
# parent_id :bigint
# type_de_champ_id :integer not null
# row_id :string
# type_de_champ_id :integer
#
class Champs::RNAChamp < Champ
include RNAChampAssociationFetchableConcern

View file

@ -5,8 +5,8 @@ module BlobSignedIdConcern
# We override signed_id to add `expires_in` option to generated hash.
# This is a measure to ensure that we never under any circumstance
# expose permanent attachment url
def signed_id
ActiveStorage.verifier.generate(id, purpose: :blob_id, expires_in: Rails.application.config.active_storage.service_urls_expire_in)
def signed_id(**options)
ActiveStorage.verifier.generate(id, **options, purpose: :blob_id, expires_in: Rails.application.config.active_storage.service_urls_expire_in)
end
end
end

View file

@ -31,9 +31,9 @@
# motivation :text
# prefill_token :string
# prefilled :boolean
# private_search_terms :text
# private_search_terms :string
# processed_at :datetime
# search_terms :text
# search_terms :string
# state :string
# termine_close_to_expiration_notice_sent_at :datetime
# created_at :datetime

View file

@ -86,7 +86,7 @@ class Export < ApplicationRecord
def flash_message
if available?
"Lexport au format \"#{format}\" est prêt. Vous pouvez le <a href=\"#{file.service_url}\">télécharger</a>"
"Lexport au format \"#{format}\" est prêt. Vous pouvez le <a href=\"#{file.url}\">télécharger</a>"
else
"Nous générons cet export. Veuillez revenir dans quelques minutes pour le télécharger."
end

View file

@ -4,6 +4,7 @@
#
# id :integer not null, primary key
# aasm_state :string default("brouillon")
# allow_expert_messaging :boolean default(TRUE), not null
# allow_expert_review :boolean default(TRUE), not null
# api_entreprise_token :string
# api_particulier_scopes :text default([]), is an Array
@ -17,10 +18,10 @@
# description :string
# dossiers_count_computed_at :datetime
# duree_conservation_dossiers_dans_ds :integer
# duree_conservation_etendue_par_ds :boolean default(FALSE)
# duree_conservation_etendue_par_ds :boolean default(FALSE), not null
# encrypted_api_particulier_token :string
# estimated_duration_visible :boolean default(TRUE), not null
# estimated_dossiers_count :integer
# estimated_duration_visible :boolean default(TRUE), not null
# euro_flag :boolean default(FALSE)
# experts_require_administrateur_invitation :boolean default(FALSE)
# for_individual :boolean default(FALSE)
@ -28,11 +29,10 @@
# instructeurs_self_management_enabled :boolean
# juridique_required :boolean default(TRUE)
# libelle :string
# lien_demarche :string
# lien_dpo :string
# lien_notice :string
# lien_site_web :string
# max_duree_conservation_dossiers_dans_ds :integer default(12)
# max_duree_conservation_dossiers_dans_ds :integer default(12), not null
# migrated_champ_routage :boolean
# monavis_embed :text
# opendata :boolean default(TRUE)

View file

@ -16,6 +16,7 @@
# last_sign_in_ip :string
# locked_at :datetime
# otp_required_for_login :boolean
# otp_secret :string
# remember_created_at :datetime
# reset_password_sent_at :datetime
# reset_password_token :string
@ -43,6 +44,7 @@ class SuperAdmin < ApplicationRecord
def disable_otp!
self.assign_attributes(
{
otp_secret: nil,
encrypted_otp_secret: nil,
encrypted_otp_secret_iv: nil,
encrypted_otp_secret_salt: nil,
@ -66,4 +68,75 @@ class SuperAdmin < ApplicationRecord
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
private
# From https://github.com/tinfoil/devise-two-factor/blob/main/UPGRADING.md
# Remove me after super admin have been migrated to the new OTP system.
# Decrypt and return the `encrypted_otp_secret` attribute which was used in
# prior versions of devise-two-factor
# @return [String] The decrypted OTP secret
def legacy_otp_secret
return nil unless self[:encrypted_otp_secret]
return nil unless self.class.otp_secret_encryption_key
hmac_iterations = 2000 # a default set by the Encryptor gem
key = self.class.otp_secret_encryption_key
salt = Base64.decode64(encrypted_otp_secret_salt)
iv = Base64.decode64(encrypted_otp_secret_iv)
raw_cipher_text = Base64.decode64(encrypted_otp_secret)
# The last 16 bytes of the ciphertext are the authentication tag - we use
# Galois Counter Mode which is an authenticated encryption mode
cipher_text = raw_cipher_text[0..-17]
auth_tag = raw_cipher_text[-16..-1]
# this alrorithm lifted from
# https://github.com/attr-encrypted/encryptor/blob/master/lib/encryptor.rb#L54
# create an OpenSSL object which will decrypt the AES cipher with 256 bit
# keys in Galois Counter Mode (GCM). See
# https://ruby.github.io/openssl/OpenSSL/Cipher.html
cipher = OpenSSL::Cipher.new('aes-256-gcm')
# tell the cipher we want to decrypt. Symmetric algorithms use a very
# similar process for encryption and decryption, hence the same object can
# do both.
cipher.decrypt
# Use a Password-Based Key Derivation Function to generate the key actually
# used for encryptoin from the key we got as input.
cipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, hmac_iterations, cipher.key_len)
# set the Initialization Vector (IV)
cipher.iv = iv
# The tag must be set after calling Cipher#decrypt, Cipher#key= and
# Cipher#iv=, but before calling Cipher#final. After all decryption is
# performed, the tag is verified automatically in the call to Cipher#final.
#
# If the auth_tag does not verify, then #final will raise OpenSSL::Cipher::CipherError
cipher.auth_tag = auth_tag
# auth_data must be set after auth_tag has been set when decrypting See
# http://ruby-doc.org/stdlib-2.0.0/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-auth_data-3D
# we are not adding any authenticated data but OpenSSL docs say this should
# still be called.
cipher.auth_data = ''
# #update is (somewhat confusingly named) the method which actually
# performs the decryption on the given chunk of data. Our OTP secret is
# short so we only need to call it once.
#
# It is very important that we call #final because:
#
# 1. The authentication tag is checked during the call to #final
# 2. Block based cipher modes (e.g. CBC) work on fixed size chunks. We need
# to call #final to get it to process the last chunk properly. The output
# of #final should be appended to the decrypted value. This isn't
# required for streaming cipher modes but including it is a best practice
# so that your code will continue to function correctly even if you later
# change to a block cipher mode.
cipher.update(cipher_text) + cipher.final
end
end

View file

@ -3,7 +3,7 @@
# Table name: trusted_device_tokens
#
# id :bigint not null, primary key
# token :string not null
# token :string
# created_at :datetime not null
# updated_at :datetime not null
# instructeur_id :bigint

View file

@ -3,7 +3,7 @@ class JwtTokenValidator < ActiveModel::EachValidator
begin
JWT.decode value, nil, false
rescue
record.errors[attribute] << (options[:message] || "n'est pas un jeton valide")
record.errors.add attribute, :invalid, message: (options[:message] || "n'est pas un jeton valide")
end
end
end

View file

@ -3,7 +3,7 @@ class MonAvisEmbedValidator < ActiveModel::Validator
# We need to ensure the embed code is not any random string in order to avoid injections
r = Regexp.new('<a href="https://monavis|voxusagers.numerique.gouv.fr/Demarches/\d+.*key=[[:alnum:]]+.*">\s*<img src="https://monavis|voxusagers.numerique.gouv.fr/(monavis-)?static/bouton-blanc|bleu.png|svg" alt="Je donne mon avis" (title="Je donne mon avis sur cette démarche" )?/>\s*</a>', Regexp::MULTILINE)
if record.monavis_embed.present? && !r.match?(record.monavis_embed)
record.errors[:base] << "Le code fourni ne correspond pas au format des codes MonAvis reconnus par la plateforme."
record.errors.add :base, :invalid, message: "Le code fourni ne correspond pas au format des codes MonAvis reconnus par la plateforme."
end
end
end

View file

@ -1,5 +1,4 @@
#!/usr/bin/env ruby
load File.expand_path("spring", __dir__)
require_relative "../config/boot"
require "rake"
Rake.application.run

View file

@ -2,7 +2,7 @@
require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
APP_ROOT = File.expand_path("..", __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
@ -13,9 +13,9 @@ FileUtils.chdir APP_ROOT do
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
puts "== Installing dependencies =="
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")
# Install JavaScript dependencies
system! 'node --version'
@ -29,13 +29,17 @@ FileUtils.chdir APP_ROOT do
FileUtils.cp 'config/env.example', '.env'
end
# Create the database, load the schema, and initialize it with the seed data
# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end
puts "\n== Preparing database =="
system! 'bin/rails db:prepare'
system! "bin/rails db:prepare"
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
system! "bin/rails log:clear tmp:clear"
puts "\n== Restarting application server =="
system! 'bin/rails restart'
system! "bin/rails restart"
end

View file

@ -98,5 +98,9 @@ module TPS
html_tag.html_safe # this is generated by rails
end
# rubocop:enable Rails/OutputSafety
#
config.active_record.encryption.primary_key = Rails.application.secrets.active_record_encryption.fetch(:primary_key)
config.active_record.encryption.key_derivation_salt = Rails.application.secrets.active_record_encryption.fetch(:key_derivation_salt)
end
end

View file

@ -142,6 +142,10 @@ API_EDUCATION_URL="https://data.education.gouv.fr/api/records/1.0"
# Encryption key for sensitive columns in the database
ENCRYPTION_SERVICE_SALT=""
# ActiveRecord encryption keys. Generate them with bin/rails db:encryption:init (you can omit deterministic_key)
AR_ENCRYPTION_PRIMARY_KEY=""
AR_ENCRYPTION_KEY_DERIVATION_SALT=""
# Salt for invisible_captcha session data.
# Must be the same value for all app instances behind a load-balancer.
INVISIBLE_CAPTCHA_SECRET="kikooloool"

View file

@ -0,0 +1,18 @@
# TODO: Enable cookies rotation when new SHA256 will be enforced
# See new_framework_defaults_7.0.rb
# key_generator_hash_digest_class = OpenSSL::Digest::SHA256 will be
#
# Rails.application.config.after_initialize do
# Rails.application.config.action_dispatch.cookies_rotations.tap do |cookies|
# salt = Rails.application.config.action_dispatch.authenticated_encrypted_cookie_salt
# secret_key_base = Rails.application.secret_key_base
# key_generator = ActiveSupport::KeyGenerator.new(
# secret_key_base, iterations: 1000, hash_digest_class: OpenSSL::Digest::SHA1
# )
# key_len = ActiveSupport::MessageEncryptor.key_len
# secret = key_generator.generate_key(salt, key_len)
# cookies.rotate :encrypted, secret
# end
# end

View file

@ -227,7 +227,7 @@ Devise.setup do |config|
# should add them to the navigational formats lists.
#
# The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ['*/*', :html]
# config.navigational_formats = ['*/*', :html, :turbo_stream]
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete
@ -253,4 +253,12 @@ Devise.setup do |config|
# When using omniauth, Devise cannot automatically set Omniauth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
# When using Devise with Hotwire/Turbo, the http status for error responses
# and some redirects must match the following. The default in Devise for existing
# apps is `200 OK` and `302 Found respectively`, but new apps are generated with
# these new defaults that match Hotwire/Turbo behavior.
# Note: These might become the new default in future versions of Devise.
config.responder.error_status = :unprocessable_entity
config.responder.redirect_status = :see_other
end

View file

@ -1,3 +1,5 @@
ActiveSupport.on_load(:action_mailer) do
require "dolist/api_sender"
ActionMailer::Base.add_delivery_method :dolist_api, Dolist::APISender
end

View file

@ -40,8 +40,10 @@ Rails.application.configure do
config.lograge.keep_original_rails_log = true
config.lograge.logger = ActiveSupport::Logger.new(Rails.root.join('log', "logstash_#{Rails.env}.log"))
end
if config.lograge.enabled
Rails.application.config.after_initialize do |app|
if app.config.lograge.enabled
ActiveJob::ApplicationLogSubscriber.attach_to(:active_job)
end
end

View file

@ -1,6 +1,8 @@
# Must be registered *before* loading custom delivery methods
# otherwise the observer won't be invoked.
#
require_relative "../../app/services/email_delivery_observer"
ActiveSupport.on_load(:action_mailer) do |mailer|
mailer.register_observer EmailDeliveryObserver
end

View file

@ -0,0 +1,133 @@
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.0 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults` to `7.0`.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
# `button_to` view helper will render `<button>` element, regardless of whether
# or not the content is passed as the first argument or as a block.
Rails.application.config.action_view.button_to_generates_button_tag = true
# `stylesheet_link_tag` view helper will not render the media attribute by default.
Rails.application.config.action_view.apply_stylesheet_media_default = false
# Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
# Changing this default means invalidate all encrypted messages generated by
# your application and, all the encrypted cookies. Only change this after you
# rotated all the messages using the key rotator.
#
# See upgrading guide for more information on how to build a rotator.
# https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
# Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
# Change the digest class for ActiveSupport::Digest.
# Changing this default means that for example Etags change and
# various cache keys leading to cache invalidation.
Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
# Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
# implementation.
Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
# Calls `Rails.application.executor.wrap` around test cases.
# This makes test cases behave closer to an actual request or job.
# Several features that are normally disabled in test, such as Active Record query cache
# and asynchronous queries will then be enabled.
Rails.application.config.active_support.executor_around_test_case = true
# Define the isolation level of most of Rails internal state.
# If you use a fiber based server or job processor, you should set it to `:fiber`.
# Otherwise the default of `:thread` if preferable.
Rails.application.config.active_support.isolation_level = :thread
# Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
Rails.application.config.action_mailer.smtp_timeout = 5
# The ActiveStorage video previewer will now use scene change detection to generate
# better preview images (rather than the previous default of using the first frame
# of the video).
Rails.application.config.active_storage.video_preview_arguments =
"-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
# Automatically infer `inverse_of` for associations with a scope.
Rails.application.config.active_record.automatic_scope_inversing = true
# Raise when running tests if fixtures contained foreign key violations
Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
# Disable partial inserts.
# This default means that all columns will be referenced in INSERT queries
# regardless of whether they have a default or not.
Rails.application.config.active_record.partial_inserts = false
# Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
Rails.application.config.action_controller.raise_on_open_redirects = true
# Change the variant processor for Active Storage.
# Changing this default means updating all places in your code that
# generate variants to use image processing macros and ruby-vips
# operations. See the upgrading guide for detail on the changes required.
# The `:mini_magick` option is not deprecated; it's fine to keep using it.
Rails.application.config.active_storage.variant_processor = :vips
# Enable parameter wrapping for JSON.
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
# To disable parameter wrapping entirely, set this config to `false`.
Rails.application.config.action_controller.wrap_parameters_by_default = true
# Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
# `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
#
# See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
# more information.
Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
# Change the default headers to disable browsers' flawed legacy XSS protection.
Rails.application.config.action_dispatch.default_headers = {
"X-Frame-Options" => "SAMEORIGIN",
"X-XSS-Protection" => "0",
"X-Content-Type-Options" => "nosniff",
"X-Download-Options" => "noopen",
"X-Permitted-Cross-Domain-Policies" => "none",
"Referrer-Policy" => "strict-origin-when-cross-origin"
}
# ** Please read carefully, this must be configured in config/application.rb **
# Change the format of the cache entry.
# Changing this default means that all new cache entries added to the cache
# will have a different format that is not supported by Rails 6.1 applications.
# Only change this value after your application is fully deployed to Rails 7.0
# and you have no plans to rollback.
# When you're ready to change format, add this to `config/application.rb` (NOT this file):
# config.active_support.cache_format_version = 7.0
# Cookie serializer: 2 options
#
# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
# is `:marshal`. The default for new apps is `:json`.
#
# Rails.application.config.action_dispatch.cookies_serializer = :json
#
#
# To migrate an existing application to the `:json` serializer, use the `:hybrid` option.
#
# Rails transparently deserializes existing (Marshal-serialized) cookies on read and
# re-writes them in the JSON format.
#
# It is fine to use `:hybrid` long term; you should do that until you're confident *all* your cookies
# have been converted to JSON. To keep using `:hybrid` long term, move this config to its own
# initializer or to `config/application.rb`.
#
# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
#
#
# If your cookies can't yet be serialized to JSON, keep using `:marshal` for backward-compatibility.
#
# If you have configured the serializer elsewhere, you can remove this section of the file.
#
# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.

View file

@ -1,94 +0,0 @@
# frozen_string_literal: true
# from https://gist.github.com/Envek/7077bfc36b17233f60ad
# PostgreSQL interval data type support from https://github.com/rails/rails/pull/16919
# Works with both Rails 5.2 and 6.0
# Place this file to config/initializers/
require "active_support/duration"
# activerecord/lib/active_record/connection_adapters/postgresql/oid/interval.rb
module ActiveRecord
module ConnectionAdapters
module PostgreSQL
module OID # :nodoc:
class Interval < Type::Value # :nodoc:
def type
:interval
end
def cast_value(value)
case value
when ::ActiveSupport::Duration
value
when ::String
begin
::ActiveSupport::Duration.parse(value)
rescue ::ActiveSupport::Duration::ISO8601Parser::ParsingError
nil
end
else
super
end
end
def serialize(value)
case value
when ::ActiveSupport::Duration
value.iso8601(precision: self.precision)
when ::Numeric
# Sometimes operations on Times returns just float number of seconds so we need to handle that.
# Example: Time.current - (Time.current + 1.hour) # => -3600.000001776 (Float)
value.seconds.iso8601(precision: self.precision)
else
super
end
end
def type_cast_for_schema(value)
serialize(value).inspect
end
end
end
end
end
end
# activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
require 'active_record/connection_adapters/postgresql_adapter'
PostgreSQLAdapterWithInterval = Module.new do
def initialize_type_map(m = type_map)
super
m.register_type "interval" do |*_args, sql_type|
precision = extract_precision(sql_type)
::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Interval.new(precision: precision)
end
end
def configure_connection
super
execute('SET intervalstyle = iso_8601', 'SCHEMA')
end
ActiveRecord::Type.register(:interval, ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Interval, adapter: :postgresql)
end
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(PostgreSQLAdapterWithInterval)
# activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
require 'active_record/connection_adapters/postgresql/schema_statements'
module SchemaStatementsWithInterval
def type_to_sql(type, limit: nil, precision: nil, scale: nil, array: nil, **)
case type.to_s
when 'interval'
case precision
when nil; "interval"
when 0..6; "interval(#{precision})"
else raise(ActiveRecordError, "No interval type has precision of #{precision}. The allowed range of precision is from 0 to 6")
end
else
super
end
end
end
ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements.prepend(SchemaStatementsWithInterval)

View file

@ -13,6 +13,9 @@ defaults: &defaults
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
encryption_service_salt: <%= ENV["ENCRYPTION_SERVICE_SALT"] %>
otp_secret_key: <%= ENV["OTP_SECRET_KEY"] %>
active_record_encryption:
primary_key: <%= ENV["AR_ENCRYPTION_PRIMARY_KEY"] %>
key_derivation_salt: <%= ENV["AR_ENCRYPTION_KEY_DERIVATION_SALT"] %>
basic_auth:
username: <%= ENV['BASIC_AUTH_USERNAME'] %>
password: <%= ENV['BASIC_AUTH_PASSWORD'] %>
@ -103,6 +106,9 @@ test:
secret_key_base: aa52abc3f3a629d04a61e9899a24c12f52b24c679cbf45f8ec0cdcc64ab9526d673adca84212882dff3911ac98e0c32ec4729ca7b3429ba18ef4dfd1bd18bc7a # ggignore
encryption_service_salt: QUDyMoXyw2YXU8pHnpts3w9MyMpsMQ6BgP62obgCf7PQv # ggignore
otp_secret_key: 78ddda3679dc0ba2c99f50bcff04f49d862358dbeb7ead50368fdd6de14392be884ee10a204a0375b4b382e1a842fafe40d7858b7ab4796ec3a67c518d31112b # ggignore
active_record_encryption:
primary_key: test-RgUyzplf0kehB5fyZpmCd37uvgb # ggignore
key_derivation_salt: test-yyMmzM9cTSD1rs3Fq3hwt3hMNg4 # ggignore
api_entreprise:
key: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ik9oIHllYWgiLCJpYXQiOjE1MTYyMzkwMjJ9.f06sBo3q2Yxnw_TYPFUEs0CozBmcV-XniH_DeKNWzKE" # ggignore
pipedrive:

View file

@ -0,0 +1,8 @@
# This migration comes from active_storage (originally 20211119233751)
class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)
change_column_null(:active_storage_blobs, :checksum, true)
end
end

View file

@ -0,0 +1,5 @@
class AddOtpSecretToSuperAdmin < ActiveRecord::Migration[7.0]
def change
add_column :super_admins, :otp_secret, :string
end
end

View file

@ -10,8 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2023_03_31_125931) do
ActiveRecord::Schema[7.0].define(version: 2023_05_02_160046) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
@ -19,17 +18,17 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "action_text_rich_texts", force: :cascade do |t|
t.text "body"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.string "name", null: false
t.bigint "record_id", null: false
t.string "record_type", null: false
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
end
create_table "active_storage_attachments", force: :cascade do |t|
t.bigint "blob_id", null: false
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.string "name", null: false
t.bigint "record_id", null: false
t.string "record_type", null: false
@ -39,18 +38,19 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "active_storage_blobs", force: :cascade do |t|
t.bigint "byte_size", null: false
t.string "checksum", null: false
t.string "checksum"
t.string "content_type"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.string "filename", null: false
t.string "key", null: false
t.integer "lock_version"
t.text "metadata"
t.string "service_name", null: false
t.string "virus_scan_result"
t.datetime "virus_scanned_at"
t.datetime "watermarked_at"
t.datetime "virus_scanned_at", precision: 6
t.datetime "watermarked_at", precision: 6
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
t.index ["virus_scan_result"], name: "index_active_storage_blobs_on_virus_scan_result"
end
create_table "active_storage_variant_records", force: :cascade do |t|
@ -60,17 +60,17 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
end
create_table "administrateurs", id: :serial, force: :cascade do |t|
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.bigint "user_id", null: false
t.index ["user_id"], name: "index_administrateurs_on_user_id"
end
create_table "administrateurs_instructeurs", id: false, force: :cascade do |t|
t.integer "administrateur_id", null: false
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.integer "instructeur_id", null: false
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.index ["administrateur_id"], name: "index_administrateurs_instructeurs_on_administrateur_id"
t.index ["instructeur_id", "administrateur_id"], name: "unique_couple_administrateur_instructeur", unique: true
t.index ["instructeur_id"], name: "index_administrateurs_instructeurs_on_instructeur_id"
@ -78,10 +78,10 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "administrateurs_procedures", id: false, force: :cascade do |t|
t.bigint "administrateur_id", null: false
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.boolean "manager"
t.bigint "procedure_id", null: false
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["administrateur_id", "procedure_id"], name: "index_unique_admin_proc_couple", unique: true
t.index ["administrateur_id"], name: "index_administrateurs_procedures_on_administrateur_id"
t.index ["procedure_id"], name: "index_administrateurs_procedures_on_procedure_id"
@ -93,9 +93,9 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.datetime "created_at", precision: 6, null: false
t.string "encrypted_token", null: false
t.string "name", null: false
t.boolean "write_access", default: true, null: false
t.datetime "updated_at", precision: 6, null: false
t.integer "version", default: 3, null: false
t.boolean "write_access", default: true, null: false
t.index ["administrateur_id"], name: "index_api_tokens_on_administrateur_id"
end
@ -119,7 +119,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
end
create_table "assign_tos", id: :serial, force: :cascade do |t|
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.boolean "daily_email_notifications_enabled", default: false, null: false
t.bigint "groupe_instructeur_id"
t.boolean "instant_email_dossier_notifications_enabled", default: false, null: false
@ -127,7 +127,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.boolean "instant_expert_avis_email_notifications_enabled", default: false
t.integer "instructeur_id"
t.boolean "manager", default: false
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.boolean "weekly_email_notifications_enabled", default: true, null: false
t.index ["groupe_instructeur_id", "instructeur_id"], name: "unique_couple_groupe_instructeur_instructeur", unique: true
t.index ["groupe_instructeur_id"], name: "index_assign_tos_on_groupe_instructeur_id"
@ -138,19 +138,19 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "attestation_templates", id: :serial, force: :cascade do |t|
t.boolean "activated"
t.text "body"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.text "footer"
t.integer "procedure_id"
t.text "title"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["procedure_id"], name: "index_attestation_templates_on_procedure_id", unique: true
end
create_table "attestations", id: :serial, force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.integer "dossier_id", null: false
t.string "title"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["dossier_id"], name: "index_attestations_on_dossier_id", unique: true
end
@ -159,16 +159,16 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.integer "claimant_id", null: false
t.string "claimant_type"
t.boolean "confidentiel", default: false, null: false
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.integer "dossier_id"
t.string "email"
t.bigint "experts_procedure_id"
t.text "introduction"
t.boolean "question_answer"
t.string "question_label"
t.datetime "reminded_at"
t.datetime "revoked_at"
t.datetime "updated_at", null: false
t.datetime "reminded_at", precision: 6
t.datetime "revoked_at", precision: 6
t.datetime "updated_at", precision: 6, null: false
t.index ["claimant_id"], name: "index_avis_on_claimant_id"
t.index ["dossier_id"], name: "index_avis_on_dossier_id"
t.index ["experts_procedure_id"], name: "index_avis_on_experts_procedure_id"
@ -177,12 +177,12 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "batch_operations", force: :cascade do |t|
t.datetime "created_at", precision: 6, null: false
t.bigint "failed_dossier_ids", default: [], null: false, array: true
t.datetime "finished_at"
t.datetime "finished_at", precision: 6
t.bigint "instructeur_id", null: false
t.string "operation", null: false
t.jsonb "payload", default: {}, null: false
t.datetime "run_at"
t.datetime "seen_at"
t.datetime "run_at", precision: 6
t.datetime "seen_at", precision: 6
t.bigint "success_dossier_ids", default: [], null: false, array: true
t.datetime "updated_at", precision: 6, null: false
end
@ -195,9 +195,9 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
end
create_table "bill_signatures", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.string "digest"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "bulk_messages", force: :cascade do |t|
@ -206,8 +206,8 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.integer "dossier_count"
t.string "dossier_state"
t.bigint "instructeur_id", null: false
t.datetime "sent_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.datetime "sent_at", precision: 6, null: false
end
create_table "bulk_messages_groupe_instructeurs", id: false, force: :cascade do |t|
@ -219,20 +219,20 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
end
create_table "champs", id: :serial, force: :cascade do |t|
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.jsonb "data"
t.integer "dossier_id", null: false
t.integer "dossier_id"
t.integer "etablissement_id"
t.string "external_id"
t.string "fetch_external_data_exceptions", array: true
t.bigint "parent_id"
t.boolean "prefilled"
t.boolean "private", default: false, null: false
t.datetime "rebased_at"
t.datetime "rebased_at", precision: 6
t.string "row_id"
t.string "type"
t.integer "type_de_champ_id"
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.string "value"
t.jsonb "value_json"
t.index ["dossier_id"], name: "index_champs_on_dossier_id"
@ -247,22 +247,22 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "closed_mails", id: :serial, force: :cascade do |t|
t.text "body"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.integer "procedure_id"
t.string "subject"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["procedure_id"], name: "index_closed_mails_on_procedure_id"
end
create_table "commentaires", id: :serial, force: :cascade do |t|
t.string "body"
t.datetime "created_at", null: false
t.datetime "discarded_at"
t.datetime "created_at", precision: 6, null: false
t.datetime "discarded_at", precision: 6
t.integer "dossier_id"
t.string "email"
t.bigint "expert_id"
t.bigint "instructeur_id"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["dossier_id"], name: "index_commentaires_on_dossier_id"
t.index ["expert_id"], name: "index_commentaires_on_expert_id"
t.index ["instructeur_id"], name: "index_commentaires_on_instructeur_id"
@ -270,30 +270,30 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "delayed_jobs", id: :serial, force: :cascade do |t|
t.integer "attempts", default: 0, null: false
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.string "cron"
t.datetime "failed_at"
t.datetime "failed_at", precision: 6
t.text "handler", null: false
t.text "last_error"
t.datetime "locked_at"
t.datetime "locked_at", precision: 6
t.string "locked_by"
t.integer "priority", default: 0, null: false
t.string "queue"
t.datetime "run_at"
t.datetime "updated_at"
t.datetime "run_at", precision: 6
t.datetime "updated_at", precision: 6
t.index ["priority", "run_at"], name: "delayed_jobs_priority"
end
create_table "deleted_dossiers", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "deleted_at"
t.datetime "created_at", precision: 6, null: false
t.datetime "deleted_at", precision: 6
t.bigint "dossier_id"
t.bigint "groupe_instructeur_id"
t.bigint "procedure_id"
t.string "reason"
t.bigint "revision_id"
t.string "state"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.bigint "user_id"
t.index ["deleted_at"], name: "index_deleted_dossiers_on_deleted_at"
t.index ["dossier_id"], name: "index_deleted_dossiers_on_dossier_id", unique: true
@ -313,14 +313,14 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "dossier_operation_logs", force: :cascade do |t|
t.boolean "automatic_operation", default: false, null: false
t.bigint "bill_signature_id"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.jsonb "data"
t.text "digest"
t.bigint "dossier_id"
t.datetime "executed_at"
t.datetime "keep_until"
t.datetime "executed_at", precision: 6
t.datetime "keep_until", precision: 6
t.string "operation", null: false
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["bill_signature_id"], name: "index_dossier_operation_logs_on_bill_signature_id"
t.index ["dossier_id"], name: "index_dossier_operation_logs_on_dossier_id"
t.index ["keep_until"], name: "index_dossier_operation_logs_on_keep_until"
@ -351,44 +351,44 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "dossiers", id: :serial, force: :cascade do |t|
t.string "api_entreprise_job_exceptions", array: true
t.boolean "archived", default: false
t.datetime "archived_at"
t.datetime "archived_at", precision: 6
t.string "archived_by"
t.boolean "autorisation_donnees"
t.bigint "batch_operation_id"
t.datetime "brouillon_close_to_expiration_notice_sent_at"
t.datetime "brouillon_close_to_expiration_notice_sent_at", precision: 6
t.interval "conservation_extension", default: "PT0S"
t.datetime "created_at"
t.datetime "declarative_triggered_at"
t.datetime "created_at", precision: 6
t.datetime "declarative_triggered_at", precision: 6
t.string "deleted_user_email_never_send"
t.datetime "depose_at"
t.datetime "depose_at", precision: 6
t.bigint "dossier_transfer_id"
t.datetime "en_construction_at"
t.datetime "en_construction_close_to_expiration_notice_sent_at"
t.datetime "en_instruction_at"
t.datetime "en_construction_at", precision: 6
t.datetime "en_construction_close_to_expiration_notice_sent_at", precision: 6
t.datetime "en_instruction_at", precision: 6
t.boolean "for_procedure_preview", default: false
t.bigint "groupe_instructeur_id"
t.datetime "groupe_instructeur_updated_at"
t.datetime "hidden_at"
t.datetime "hidden_by_administration_at"
t.datetime "groupe_instructeur_updated_at", precision: 6
t.datetime "hidden_at", precision: 6
t.datetime "hidden_by_administration_at", precision: 6
t.string "hidden_by_reason"
t.datetime "hidden_by_user_at"
t.datetime "identity_updated_at"
t.datetime "last_avis_updated_at"
t.datetime "last_champ_private_updated_at"
t.datetime "last_champ_updated_at"
t.datetime "last_commentaire_updated_at"
t.datetime "hidden_by_user_at", precision: 6
t.datetime "identity_updated_at", precision: 6
t.datetime "last_avis_updated_at", precision: 6
t.datetime "last_champ_private_updated_at", precision: 6
t.datetime "last_champ_updated_at", precision: 6
t.datetime "last_commentaire_updated_at", precision: 6
t.boolean "migrated_champ_routage"
t.text "motivation"
t.bigint "parent_dossier_id"
t.string "prefill_token"
t.boolean "prefilled"
t.string "private_search_terms"
t.datetime "processed_at"
t.datetime "processed_at", precision: 6
t.bigint "revision_id"
t.text "search_terms"
t.string "search_terms"
t.string "state"
t.datetime "termine_close_to_expiration_notice_sent_at"
t.datetime "updated_at"
t.datetime "termine_close_to_expiration_notice_sent_at", precision: 6
t.datetime "updated_at", precision: 6
t.integer "user_id"
t.index ["archived"], name: "index_dossiers_on_archived"
t.index ["batch_operation_id"], name: "index_dossiers_on_batch_operation_id"
@ -405,7 +405,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.datetime "created_at", precision: 6, null: false
t.string "message_id"
t.string "method", null: false
t.datetime "processed_at"
t.datetime "processed_at", precision: 6
t.string "status", null: false
t.string "subject", null: false
t.string "to", null: false
@ -423,7 +423,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.string "code_insee_localite"
t.string "code_postal"
t.string "complement_adresse"
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.boolean "diffusable_commercialement"
t.integer "dossier_id"
t.string "enseigne"
@ -455,18 +455,18 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.boolean "siege_social"
t.string "siret"
t.string "type_voie"
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.index ["dossier_id"], name: "index_etablissements_on_dossier_id", unique: true
end
create_table "exercices", id: :serial, force: :cascade do |t|
t.string "ca"
t.datetime "created_at"
t.datetime "dateFinExercice"
t.datetime "date_fin_exercice"
t.datetime "created_at", precision: 6
t.datetime "dateFinExercice", precision: 6
t.datetime "date_fin_exercice", precision: 6
t.integer "date_fin_exercice_timestamp"
t.integer "etablissement_id"
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.index ["etablissement_id"], name: "index_exercices_on_etablissement_id"
end
@ -482,15 +482,15 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.datetime "created_at", precision: 6, null: false
t.bigint "expert_id", null: false
t.bigint "procedure_id", null: false
t.datetime "revoked_at"
t.datetime "updated_at", precision: 6, null: false
t.datetime "revoked_at", precision: 6
t.index ["expert_id", "procedure_id"], name: "index_experts_procedures_on_expert_id_and_procedure_id", unique: true
t.index ["expert_id"], name: "index_experts_procedures_on_expert_id"
t.index ["procedure_id"], name: "index_experts_procedures_on_procedure_id"
end
create_table "exports", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.string "format", null: false
t.string "job_status", default: "pending", null: false
t.text "key", null: false
@ -498,44 +498,44 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.jsonb "procedure_presentation_snapshot"
t.string "statut", default: "tous"
t.string "time_span_type", default: "everything", null: false
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["format", "time_span_type", "statut", "key"], name: "index_exports_on_format_and_time_span_type_and_statut_and_key", unique: true
t.index ["procedure_presentation_id"], name: "index_exports_on_procedure_presentation_id"
end
create_table "exports_groupe_instructeurs", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.bigint "export_id", null: false
t.bigint "groupe_instructeur_id", null: false
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "flipper_features", id: false, force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.bigserial "id", null: false
t.string "key", null: false
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "flipper_gates", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.string "feature_key", null: false
t.string "key", null: false
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.string "value"
t.index ["feature_key", "key", "value"], name: "index_flipper_gates_on_feature_key_and_key_and_value", unique: true
end
create_table "follows", id: :serial, force: :cascade do |t|
t.datetime "annotations_privees_seen_at", null: false
t.datetime "avis_seen_at", null: false
t.datetime "created_at"
t.datetime "demande_seen_at", null: false
t.datetime "annotations_privees_seen_at", precision: 6, null: false
t.datetime "avis_seen_at", precision: 6, null: false
t.datetime "created_at", precision: 6
t.datetime "demande_seen_at", precision: 6, null: false
t.integer "dossier_id", null: false
t.integer "instructeur_id", null: false
t.datetime "messagerie_seen_at", null: false
t.datetime "unfollowed_at"
t.datetime "updated_at"
t.datetime "messagerie_seen_at", precision: 6, null: false
t.datetime "unfollowed_at", precision: 6
t.datetime "updated_at", precision: 6
t.index ["dossier_id"], name: "index_follows_on_dossier_id"
t.index ["instructeur_id", "dossier_id", "unfollowed_at"], name: "uniqueness_index", unique: true
t.index ["instructeur_id"], name: "index_follows_on_instructeur_id"
@ -545,7 +545,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "france_connect_informations", id: :serial, force: :cascade do |t|
t.date "birthdate"
t.string "birthplace"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.jsonb "data"
t.string "email_france_connect"
t.string "family_name"
@ -553,8 +553,8 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.string "gender"
t.string "given_name"
t.string "merge_token"
t.datetime "merge_token_created_at"
t.datetime "updated_at", null: false
t.datetime "merge_token_created_at", precision: 6
t.datetime "updated_at", precision: 6, null: false
t.integer "user_id"
t.index ["merge_token"], name: "index_france_connect_informations_on_merge_token"
t.index ["user_id"], name: "index_france_connect_informations_on_user_id"
@ -562,23 +562,23 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "geo_areas", force: :cascade do |t|
t.bigint "champ_id"
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.string "geo_reference_id"
t.jsonb "geometry"
t.jsonb "properties"
t.string "source"
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.index ["champ_id"], name: "index_geo_areas_on_champ_id"
t.index ["source"], name: "index_geo_areas_on_source"
end
create_table "groupe_instructeurs", force: :cascade do |t|
t.boolean "closed", default: false
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.text "label", null: false
t.bigint "procedure_id", null: false
t.jsonb "routing_rule"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["closed", "procedure_id"], name: "index_groupe_instructeurs_on_closed_and_procedure_id"
t.index ["procedure_id", "label"], name: "index_groupe_instructeurs_on_procedure_id_and_label", unique: true
t.index ["procedure_id"], name: "index_groupe_instructeurs_on_procedure_id"
@ -586,43 +586,43 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "individuals", id: :serial, force: :cascade do |t|
t.date "birthdate"
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.integer "dossier_id"
t.string "gender"
t.string "nom"
t.string "prenom"
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.index ["dossier_id"], name: "index_individuals_on_dossier_id", unique: true
end
create_table "initiated_mails", id: :serial, force: :cascade do |t|
t.text "body"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.integer "procedure_id"
t.string "subject"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["procedure_id"], name: "index_initiated_mails_on_procedure_id"
end
create_table "instructeurs", id: :serial, force: :cascade do |t|
t.string "agent_connect_id"
t.boolean "bypass_email_login_token", default: false, null: false
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.text "encrypted_login_token"
t.datetime "login_token_created_at"
t.datetime "updated_at"
t.datetime "login_token_created_at", precision: 6
t.datetime "updated_at", precision: 6
t.bigint "user_id", null: false
t.index ["agent_connect_id"], name: "index_instructeurs_on_agent_connect_id", unique: true
t.index ["user_id"], name: "index_instructeurs_on_user_id"
end
create_table "invites", id: :serial, force: :cascade do |t|
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.integer "dossier_id"
t.string "email"
t.string "email_sender"
t.text "message"
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.integer "user_id"
t.index ["dossier_id"], name: "index_invites_on_dossier_id"
t.index ["email", "dossier_id"], name: "index_invites_on_email_and_dossier_id", unique: true
@ -639,32 +639,32 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "module_api_cartos", id: :serial, force: :cascade do |t|
t.boolean "cadastre", default: false
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.boolean "migrated"
t.integer "procedure_id"
t.boolean "quartiers_prioritaires", default: false
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.boolean "use_api_carto", default: false
t.index ["procedure_id"], name: "index_module_api_cartos_on_procedure_id", unique: true
end
create_table "procedure_presentations", id: :serial, force: :cascade do |t|
t.integer "assign_to_id"
t.datetime "created_at"
t.jsonb "displayed_fields", default: [{"label"=>"Demandeur", "table"=>"user", "column"=>"email"}], null: false
t.jsonb "filters", default: {"tous"=>[], "suivis"=>[], "traites"=>[], "a-suivre"=>[], "archives"=>[], "expirant"=>[], "supprimes_recemment"=>[]}, null: false
t.jsonb "sort", default: {"order"=>"desc", "table"=>"notifications", "column"=>"notifications"}, null: false
t.datetime "updated_at"
t.datetime "created_at", precision: 6
t.jsonb "displayed_fields", default: [{ "label" => "Demandeur", "table" => "user", "column" => "email" }], null: false
t.jsonb "filters", default: { "tous" => [], "suivis" => [], "traites" => [], "a-suivre" => [], "archives" => [], "expirant" => [], "supprimes_recemment" => [] }, null: false
t.jsonb "sort", default: { "order" => "desc", "table" => "notifications", "column" => "notifications" }, null: false
t.datetime "updated_at", precision: 6
t.index ["assign_to_id"], name: "index_procedure_presentations_on_assign_to_id", unique: true
end
create_table "procedure_revision_types_de_champ", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.bigint "parent_id"
t.integer "position", null: false
t.bigint "revision_id", null: false
t.bigint "type_de_champ_id", null: false
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["parent_id"], name: "index_procedure_revision_types_de_champ_on_parent_id"
t.index ["revision_id"], name: "index_procedure_revision_types_de_champ_on_revision_id"
t.index ["type_de_champ_id"], name: "index_procedure_revision_types_de_champ_on_type_de_champ_id"
@ -672,12 +672,12 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "procedure_revisions", force: :cascade do |t|
t.bigint "attestation_template_id"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.bigint "dossier_submitted_message_id"
t.boolean "migrated_champ_routage"
t.bigint "procedure_id", null: false
t.datetime "published_at"
t.datetime "updated_at", null: false
t.datetime "published_at", precision: 6
t.datetime "updated_at", precision: 6, null: false
t.index ["attestation_template_id"], name: "index_procedure_revisions_on_attestation_template_id"
t.index ["dossier_submitted_message_id"], name: "index_procedure_revisions_on_dossier_submitted_message_id"
t.index ["procedure_id"], name: "index_procedure_revisions_on_procedure_id"
@ -696,24 +696,24 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.bigint "canonical_procedure_id"
t.boolean "cerfa_flag", default: false
t.boolean "cloned_from_library", default: false
t.datetime "closed_at"
t.datetime "created_at", null: false
t.datetime "closed_at", precision: 6
t.datetime "created_at", precision: 6, null: false
t.string "declarative_with_state"
t.bigint "defaut_groupe_instructeur_id"
t.string "description"
t.string "direction"
t.datetime "dossiers_count_computed_at"
t.datetime "dossiers_count_computed_at", precision: 6
t.bigint "draft_revision_id"
t.integer "duree_conservation_dossiers_dans_ds"
t.boolean "duree_conservation_etendue_par_ds", default: false
t.boolean "duree_conservation_etendue_par_ds", default: false, null: false
t.boolean "durees_conservation_required", default: true
t.string "encrypted_api_particulier_token"
t.boolean "estimated_duration_visible", default: true, null: false
t.integer "estimated_dossiers_count"
t.boolean "estimated_duration_visible", default: true, null: false
t.boolean "euro_flag", default: false
t.boolean "experts_require_administrateur_invitation", default: false
t.boolean "for_individual", default: false
t.datetime "hidden_at"
t.datetime "hidden_at", precision: 6
t.boolean "instructeurs_self_management_enabled"
t.boolean "juridique_required", default: true
t.string "libelle"
@ -721,7 +721,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.string "lien_dpo"
t.string "lien_notice"
t.string "lien_site_web"
t.integer "max_duree_conservation_dossiers_dans_ds", default: 12
t.integer "max_duree_conservation_dossiers_dans_ds", default: 12, null: false
t.boolean "migrated_champ_routage"
t.text "monavis_embed"
t.boolean "opendata", default: true
@ -730,18 +730,18 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.string "path", null: false
t.boolean "piece_justificative_multiple", default: true, null: false
t.boolean "procedure_expires_when_termine_enabled", default: true
t.datetime "published_at"
t.datetime "published_at", precision: 6
t.bigint "published_revision_id"
t.bigint "replaced_by_procedure_id"
t.text "routing_criteria_name", default: "Votre ville"
t.boolean "routing_enabled"
t.bigint "service_id"
t.text "tags", default: [], array: true
t.datetime "test_started_at"
t.datetime "unpublished_at"
t.datetime "updated_at", null: false
t.datetime "test_started_at", precision: 6
t.datetime "unpublished_at", precision: 6
t.datetime "updated_at", precision: 6, null: false
t.string "web_hook_url"
t.datetime "whitelisted_at"
t.datetime "whitelisted_at", precision: 6
t.bigint "zone_id"
t.index ["api_particulier_sources"], name: "index_procedures_on_api_particulier_sources", using: :gin
t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state"
@ -770,19 +770,19 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "received_mails", id: :serial, force: :cascade do |t|
t.text "body"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.integer "procedure_id"
t.string "subject"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["procedure_id"], name: "index_received_mails_on_procedure_id"
end
create_table "refused_mails", id: :serial, force: :cascade do |t|
t.text "body"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.integer "procedure_id"
t.string "subject"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["procedure_id"], name: "index_refused_mails_on_procedure_id"
end
@ -795,7 +795,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "services", force: :cascade do |t|
t.bigint "administrateur_id"
t.text "adresse"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.string "email"
t.jsonb "etablissement_infos", default: {}
t.decimal "etablissement_lat", precision: 10, scale: 6
@ -806,7 +806,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.string "siret"
t.string "telephone"
t.string "type_organisme", null: false
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["administrateur_id", "nom"], name: "index_services_on_administrateur_id_and_nom", unique: true
t.index ["administrateur_id"], name: "index_services_on_administrateur_id"
end
@ -828,8 +828,8 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "super_admins", id: :serial, force: :cascade do |t|
t.integer "consumed_timestep"
t.datetime "created_at"
t.datetime "current_sign_in_at"
t.datetime "created_at", precision: 6
t.datetime "current_sign_in_at", precision: 6
t.string "current_sign_in_ip"
t.string "email", default: "", null: false
t.string "encrypted_otp_secret"
@ -837,23 +837,23 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.string "encrypted_otp_secret_salt"
t.string "encrypted_password", default: "", null: false
t.integer "failed_attempts", default: 0, null: false
t.datetime "last_sign_in_at"
t.datetime "last_sign_in_at", precision: 6
t.string "last_sign_in_ip"
t.datetime "locked_at"
t.datetime "locked_at", precision: 6
t.boolean "otp_required_for_login"
t.datetime "remember_created_at"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at", precision: 6
t.datetime "reset_password_sent_at", precision: 6
t.string "otp_secret"
t.string "reset_password_token"
t.integer "sign_in_count", default: 0, null: false
t.boolean "team_account", default: false
t.string "unlock_token"
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.index ["email"], name: "index_super_admins_on_email", unique: true
t.index ["reset_password_token"], name: "index_super_admins_on_reset_password_token", unique: true
t.index ["unlock_token"], name: "index_super_admins_on_unlock_token", unique: true
end
create_table "targeted_user_links", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
create_table "targeted_user_links", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
t.datetime "created_at", precision: 6, null: false
t.string "target_context", null: false
t.bigint "target_model_id", null: false
@ -874,23 +874,23 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.string "motivation"
t.boolean "process_expired"
t.boolean "process_expired_migrated", default: false
t.datetime "processed_at"
t.datetime "processed_at", precision: 6
t.string "state"
t.index ["dossier_id"], name: "index_traitements_on_dossier_id"
t.index ["process_expired"], name: "index_traitements_on_process_expired"
end
create_table "trusted_device_tokens", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.bigint "instructeur_id"
t.string "token", null: false
t.datetime "updated_at", null: false
t.string "token"
t.datetime "updated_at", precision: 6, null: false
t.index ["instructeur_id"], name: "index_trusted_device_tokens_on_instructeur_id"
end
create_table "types_de_champ", id: :serial, force: :cascade do |t|
t.jsonb "condition"
t.datetime "created_at"
t.datetime "created_at", precision: 6
t.text "description"
t.string "libelle"
t.boolean "mandatory", default: false
@ -898,35 +898,36 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
t.boolean "private", default: false, null: false
t.bigint "stable_id"
t.string "type_champ"
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.index ["private"], name: "index_types_de_champ_on_private"
t.index ["stable_id"], name: "index_types_de_champ_on_stable_id"
end
create_table "users", id: :serial, force: :cascade do |t|
t.datetime "confirmation_sent_at"
t.datetime "confirmation_sent_at", precision: 6
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "created_at"
t.datetime "current_sign_in_at"
t.datetime "confirmed_at", precision: 6
t.datetime "created_at", precision: 6
t.datetime "current_sign_in_at", precision: 6
t.string "current_sign_in_ip"
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.integer "failed_attempts", default: 0, null: false
t.datetime "last_sign_in_at"
t.datetime "last_sign_in_at", precision: 6
t.string "last_sign_in_ip"
t.string "locale"
t.datetime "locked_at"
t.datetime "locked_at", precision: 6
t.string "loged_in_with_france_connect", default: "false"
t.datetime "remember_created_at"
t.datetime "remember_created_at", precision: 6
t.bigint "requested_merge_into_id"
t.datetime "reset_password_sent_at"
t.datetime "reset_password_sent_at", precision: 6
t.string "reset_password_token"
t.integer "sign_in_count", default: 0, null: false
t.string "siret"
t.boolean "team_account", default: false
t.text "unconfirmed_email"
t.string "unlock_token"
t.datetime "updated_at"
t.datetime "updated_at", precision: 6
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["requested_merge_into_id"], name: "index_users_on_requested_merge_into_id"
@ -937,19 +938,19 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
create_table "virus_scans", force: :cascade do |t|
t.string "blob_key"
t.bigint "champ_id"
t.datetime "created_at", null: false
t.datetime "scanned_at"
t.datetime "created_at", precision: 6, null: false
t.datetime "scanned_at", precision: 6
t.string "status"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["champ_id"], name: "index_virus_scans_on_champ_id"
end
create_table "without_continuation_mails", id: :serial, force: :cascade do |t|
t.text "body"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.integer "procedure_id"
t.string "subject"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["procedure_id"], name: "index_without_continuation_mails_on_procedure_id"
end
@ -996,6 +997,8 @@ ActiveRecord::Schema.define(version: 2023_03_31_125931) do
add_foreign_key "commentaires", "dossiers"
add_foreign_key "commentaires", "experts"
add_foreign_key "commentaires", "instructeurs"
add_foreign_key "dossier_batch_operations", "batch_operations"
add_foreign_key "dossier_batch_operations", "dossiers"
add_foreign_key "dossier_operation_logs", "bill_signatures"
add_foreign_key "dossier_transfer_logs", "dossiers"
add_foreign_key "dossiers", "batch_operations"

View file

@ -326,7 +326,10 @@ describe Administrateurs::GroupeInstructeursController, type: :controller do
describe '#remove_instructeur' do
let!(:instructeur) { create(:instructeur) }
before { gi_1_1.instructeurs << admin.instructeur << instructeur }
before do
gi_1_1.instructeurs << admin.instructeur << instructeur
procedure.update(routing_enabled: true)
end
def remove_instructeur(instructeur)
delete :remove_instructeur,

View file

@ -38,7 +38,7 @@ describe AttachmentsController, type: :controller do
end
context 'when not authenticated' do
it { is_expected.to have_http_status(401) }
it { is_expected.to redirect_to(new_user_session_path) }
end
end
@ -79,7 +79,7 @@ describe AttachmentsController, type: :controller do
end
context 'when not authenticated' do
it { is_expected.to have_http_status(401) }
it { is_expected.to redirect_to(new_user_session_path) }
it 'doesnt remove the attachment' do
subject

View file

@ -147,7 +147,7 @@ describe Champs::RNAController, type: :controller do
context 'when user is not signed in' do
subject! { get :show, params: { champ_id: champ.id }, format: :turbo_stream }
it { expect(response.code).to eq('401') }
it { expect(response.code).to redirect_to(new_user_session_path) }
end
end
end

View file

@ -152,7 +152,7 @@ describe Champs::SiretController, type: :controller do
context 'when user is not signed in' do
subject! { get :show, params: { champ_id: champ.id }, format: :turbo_stream }
it { expect(response.code).to eq('401') }
it { expect(response).to redirect_to(new_user_session_path) }
end
end
end

View file

@ -44,7 +44,7 @@ describe Users::SessionsController, type: :controller do
end
context 'when a previous path was registered' do
let(:stored_path) { 'a_path' }
let(:stored_path) { '/a_path' }
before { controller.store_location_for(:user, stored_path) }

View file

@ -11,7 +11,7 @@ RSpec.describe ApplicationMailer, type: :mailer do
end
context 'when the server handles invalid emails with Net::SMTPSyntaxError' do
let(:smtp_error) { Net::SMTPSyntaxError.new }
let(:smtp_error) { Net::SMTPSyntaxError.new('400 unexpected recipients: want atleast 1, got 0') }
it { expect(subject.message).to be_an_instance_of(ActionMailer::Base::NullMail) }
end
@ -96,7 +96,7 @@ RSpec.describe ApplicationMailer, type: :mailer do
end
context "smtp server busy" do
let(:smtp_error) { Net::SMTPServerBusy.new }
let(:smtp_error) { Net::SMTPServerBusy.new('451 4.7.500 Server busy') }
it "re-raise an error and creates an event" do
expect { subject.deliver_now }.to change { EmailEvent.count }.by(1).and raise_error(MailDeliveryError)

View file

@ -58,7 +58,10 @@ describe SuperAdmin, type: :model do
it 'nullifies otp_secret' do
super_admin.enable_otp!
expect { subject }.to change { super_admin.reload.otp_secret }.to(nil)
expect(super_admin.reload.otp_secret).not_to be_nil
super_admin.disable_otp!
expect(super_admin.reload.otp_secret).to be_nil
end
end

View file

@ -2,7 +2,7 @@ describe ProcedureArchiveService do
let(:procedure) { build(:procedure) }
let(:archive) { create(:archive) }
let(:file) { Tempfile.new }
let(:fixture_blob) { ActiveStorage::Blob.create_before_direct_upload!(filename: File.basename(file.path), byte_size: file.size, checksum: 'osf') }
let(:fixture_blob) { ActiveStorage::Blob.create_before_direct_upload!(filename: File.basename(file.path), byte_size: file.size, checksum: 'osf', content_type: 'text/plain') }
let(:uploader) { ArchiveUploader.new(procedure: procedure, filename: archive.filename(procedure), filepath: file.path) }

View file

@ -1,4 +1,4 @@
describe 'admin/_closed_mail_template_attestation_inconsistency_alert.html.haml', type: :view do
describe 'admin/_closed_mail_template_attestation_inconsistency_alert', type: :view do
let(:procedure) { create(:procedure, closed_mail: closed_mail, attestation_template: attestation_template) }
let(:attestation_template) { nil }

View file

@ -1,4 +1,4 @@
describe 'administrateurs/experts_procedures/index.html.haml', type: :view do
describe 'administrateurs/experts_procedures/index', type: :view do
let!(:procedure) { create(:procedure, :published) }
before do

View file

@ -1,4 +1,4 @@
describe 'administrateurs/mail_templates/edit.html.haml', type: :view do
describe 'administrateurs/mail_templates/edit', type: :view do
let(:procedure) { create(:procedure) }
let(:mail_template) { create(:received_mail, procedure: procedure) }
let(:all_tags) { mail_template.tags }

View file

@ -1,4 +1,4 @@
describe 'administrateurs/procedures/edit.html.haml' do
RSpec.describe 'administrateurs/procedures/edit', type: :view do
let(:logo) { fixture_file_upload('spec/fixtures/files/logo_test_procedure.png', 'image/png') }
let(:procedure) { create(:procedure, logo: logo, lien_site_web: 'http://some.website') }

View file

@ -1,4 +1,4 @@
describe 'administrateurs/procedures/show.html.haml', type: :view do
describe 'administrateurs/procedures/show', type: :view do
let(:closed_at) { nil }
let(:procedure) { create(:procedure, :with_service, closed_at: closed_at) }

View file

@ -1,4 +1,4 @@
describe 'administrateurs/procedures/zones.html.haml' do
describe 'administrateurs/procedures/zones' do
let(:procedure) { create(:procedure) }
let(:populate_zones_task) { Rake::Task['after_party:populate_zones'] }

View file

@ -1,4 +1,4 @@
RSpec.describe 'commencer/show.html.haml', type: :view do
RSpec.describe 'commencer/show', type: :view do
include Rails.application.routes.url_helpers
let(:stored_query_params) { false }

View file

@ -1,4 +1,4 @@
describe 'dossiers/dossier_vide.pdf.prawn', type: :view do
describe 'dossiers/dossier_vide', type: :view do
let(:procedure) { create(:procedure, :with_all_champs, :with_drop_down_list) }
let(:dossier) { create(:dossier, procedure: procedure) }

View file

@ -1,4 +1,4 @@
describe 'experts/avis/index.html.haml', type: :view do
describe 'experts/avis/index', type: :view do
let(:expert) { create(:expert) }
let(:claimant) { create(:instructeur) }
let(:procedure) { create(:procedure) }

View file

@ -1,4 +1,4 @@
describe 'experts/avis/instruction.html.haml', type: :view do
describe 'experts/avis/instruction', type: :view do
let(:expert) { create(:expert) }
let(:claimant) { create(:instructeur) }
let(:procedure) { create(:procedure) }

View file

@ -1,9 +1,9 @@
describe 'instructeurs/dossiers/envoyer_dossier_block.html.haml', type: :view do
describe 'instructeurs/dossiers/envoyer_dossier_block', type: :view do
let(:dossier) { create(:dossier) }
subject do
render(
'instructeurs/dossiers/envoyer_dossier_block.html.haml',
'instructeurs/dossiers/envoyer_dossier_block',
dossier: dossier,
potential_recipients: potential_recipients
)

View file

@ -1,4 +1,4 @@
describe 'instructeur/dossiers/expiration_banner.html.haml', type: :view do
describe 'instructeur/dossiers/expiration_banner', type: :view do
include DossierHelper
let(:duree_conservation_dossiers_dans_ds) { 3 }
let(:dossier) do
@ -10,7 +10,7 @@ describe 'instructeur/dossiers/expiration_banner.html.haml', type: :view do
end
let(:i18n_key_state) { state }
subject do
render('instructeurs/dossiers/expiration_banner.html.haml',
render('instructeurs/dossiers/expiration_banner',
dossier: dossier,
current_user: build(:user))
end

View file

@ -1,8 +1,8 @@
describe 'instructeurs/dossiers/instruction_button.html.haml', type: :view do
describe 'instructeurs/dossiers/instruction_button', type: :view do
include DossierHelper
subject! do
render('instructeurs/dossiers/instruction_button.html.haml', dossier: dossier)
render('instructeurs/dossiers/instruction_button', dossier: dossier)
end
matcher :have_dropdown_title do |expected_title|

View file

@ -1,9 +1,9 @@
describe 'instructeurs/dossiers/instruction_button_motivation.html.haml', type: :view do
describe 'instructeurs/dossiers/instruction_button_motivation', type: :view do
let(:dossier) { create(:dossier, :en_instruction) }
subject do
render(
'instructeurs/dossiers/instruction_button_motivation.html.haml',
'instructeurs/dossiers/instruction_button_motivation',
dossier: dossier,
popup_title: 'Accepter le dossier',
placeholder: 'Expliquez au demandeur pourquoi ce dossier est accepté (facultatif)',

View file

@ -1,4 +1,4 @@
describe 'instructeurs/dossiers/print.html.haml', type: :view do
describe 'instructeurs/dossiers/print', type: :view do
before { view.extend DossierHelper }
context "with a dossier" do

View file

@ -1,4 +1,4 @@
describe 'instructeurs/dossiers/show.html.haml', type: :view do
describe 'instructeurs/dossiers/show', type: :view do
let(:current_instructeur) { create(:instructeur) }
let(:dossier) { create(:dossier, :en_construction) }

View file

@ -1,8 +1,8 @@
describe 'instructeurs/procedures/_list.html.haml', type: :view do
describe 'instructeurs/procedures/_list', type: :view do
let(:procedure) { create(:procedure, id: 1, procedure_expires_when_termine_enabled: expiration_enabled) }
subject do
render('instructeurs/procedures/list.html.haml',
render('instructeurs/procedures/list',
p: procedure,
dossiers_count_per_procedure: 5,
dossiers_a_suivre_count_per_procedure: 2,

View file

@ -1,4 +1,4 @@
describe 'instructeurs/procedures/_synthese.html.haml', type: :view do
describe 'instructeurs/procedures/_synthese', type: :view do
let(:current_instructeur) { create(:instructeur) }
let(:procedure) { create(:procedure) }
let!(:dossier) { create(:dossier, procedure: procedure) }
@ -7,7 +7,7 @@ describe 'instructeurs/procedures/_synthese.html.haml', type: :view do
let(:procedure2) { create(:procedure) }
subject {
render 'instructeurs/procedures/synthese.html.haml',
render 'instructeurs/procedures/synthese',
all_dossiers_counts: {
'à suivre': 0,
'suivis': 0,
@ -27,7 +27,7 @@ describe 'instructeurs/procedures/_synthese.html.haml', type: :view do
context 'when instructeur has 1 procedure and 1 file, table is not shown' do
subject {
render 'instructeurs/procedures/synthese.html.haml',
render 'instructeurs/procedures/synthese',
all_dossiers_counts: {
'à suivre': 0,
'suivis': 0,

View file

@ -1,10 +1,10 @@
describe 'instructeurs/procedures/_tabs.html.haml', type: :view do
describe 'instructeurs/procedures/_tabs', type: :view do
let(:procedure) { create(:procedure, id: 1, procedure_expires_when_termine_enabled: expiration_enabled) }
before { allow(view).to receive(:current_instructeur).and_return(create(:instructeur)) }
subject do
render('instructeurs/procedures/tabs.html.haml',
render('instructeurs/procedures/tabs',
procedure: procedure,
statut: 'tous',
a_suivre_count: 0,

View file

@ -1,4 +1,4 @@
describe 'instructeur_mailer/send_notifications.html.haml', type: :view do
describe 'instructeur_mailer/send_notifications', type: :view do
let(:instructeur) { create(:instructeur) }
before do

View file

@ -1,4 +1,4 @@
describe 'layouts/_header.html.haml', type: :view do
describe 'layouts/_header', type: :view do
let(:current_instructeur) { nil }
before do

View file

@ -1,4 +1,4 @@
describe 'layouts/procedure_context.html.haml', type: :view do
describe 'layouts/procedure_context', type: :view do
let(:procedure) { create(:simple_procedure, :with_service) }
let(:dossier) { create(:dossier, procedure: procedure) }
@ -9,7 +9,7 @@ describe 'layouts/procedure_context.html.haml', type: :view do
end
subject do
render html: 'Column content', layout: 'layouts/procedure_context.html.haml'
render html: 'Column content', layout: 'layouts/procedure_context'
end
context 'when a procedure is assigned' do

View file

@ -1,8 +1,8 @@
describe 'prefill_descriptions/types_de_champs.html.haml', type: :view do
describe 'prefill_descriptions/types_de_champs', type: :view do
let(:prefill_description) { PrefillDescription.new(create(:procedure)) }
let!(:type_de_champ) { create(:type_de_champ_drop_down_list, procedure: prefill_description, drop_down_options: options) }
subject { render('prefill_descriptions/types_de_champs.html.haml', prefill_description: prefill_description) }
subject { render('prefill_descriptions/types_de_champs', prefill_description: prefill_description) }
context 'when a type de champ has too many values' do
let(:options) { (1..20).map(&:to_s) }

View file

@ -1,4 +1,4 @@
describe 'shared/_procedure_description.html.haml', type: :view do
describe 'shared/_procedure_description', type: :view do
let(:estimated_duration_visible) { true }
let(:procedure) { create(:procedure, :published, :with_service, estimated_duration_visible:) }

View file

@ -1,4 +1,4 @@
RSpec.describe 'shared/archives/_table.html.haml', type: :view do
RSpec.describe 'shared/archives/_table', type: :view do
include Rails.application.routes.url_helpers
let(:procedure) { create(:procedure) }
@ -10,7 +10,7 @@ RSpec.describe 'shared/archives/_table.html.haml', type: :view do
allow(view).to receive(:create_archive_url).and_return("/archive/created/stubed")
end
subject { render 'shared/archives/table.html.haml', count_dossiers_termines_by_month: { month_date => 5 }, archives: all_archives + [monthly_archive].compact, average_dossier_weight: average_dossier_weight, procedure: procedure }
subject { render 'shared/archives/table', count_dossiers_termines_by_month: { month_date => 5 }, archives: all_archives + [monthly_archive].compact, average_dossier_weight: average_dossier_weight, procedure: procedure }
context "when archive is available" do
let(:monthly_archive) { create(:archive, time_span_type: "monthly", month: month_date, job_status: :generated, file: Rack::Test::UploadedFile.new('spec/fixtures/files/RIB.pdf', 'application/pdf')) }

View file

@ -1,7 +1,7 @@
describe 'shared/avis/_list.html.haml', type: :view do
describe 'shared/avis/_list', type: :view do
before { view.extend DossierHelper }
subject { render 'shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, expert_or_instructeur: instructeur }
subject { render 'shared/avis/list', avis: avis, avis_seen_at: seen_at, expert_or_instructeur: instructeur }
let(:instructeur) { create(:instructeur) }
let(:instructeur2) { create(:instructeur) }

View file

@ -1,4 +1,4 @@
describe 'views/shared/champs/multiple_drop_down_list/_show.html.haml', type: :view do
describe 'views/shared/champs/multiple_drop_down_list/_show', type: :view do
let(:champ) { build(:champ_multiple_drop_down_list, value: ['abc', '2, 3, 4']) }
subject { render partial: 'shared/champs/multiple_drop_down_list/show', locals: { champ: champ } }

View file

@ -1,4 +1,4 @@
describe 'shared/dossiers/champs.html.haml', type: :view do
describe 'shared/dossiers/champs', type: :view do
let(:instructeur) { create(:instructeur) }
let(:demande_seen_at) { nil }
@ -8,7 +8,7 @@ describe 'shared/dossiers/champs.html.haml', type: :view do
allow(view).to receive(:current_instructeur).and_return(instructeur)
end
subject { render 'shared/dossiers/champs.html.haml', champs: champs, dossier: dossier, demande_seen_at: demande_seen_at, profile: nil }
subject { render 'shared/dossiers/champs', champs: champs, dossier: dossier, demande_seen_at: demande_seen_at, profile: nil }
context "there are some champs" do
let(:dossier) { create(:dossier) }

View file

@ -1,4 +1,4 @@
describe 'shared/dossiers/demande.html.haml', type: :view do
describe 'shared/dossiers/demande', type: :view do
let(:current_instructeur) { create(:instructeur) }
let(:individual) { nil }
let(:etablissement) { nil }
@ -9,7 +9,7 @@ describe 'shared/dossiers/demande.html.haml', type: :view do
sign_in(current_instructeur.user)
end
subject { render 'shared/dossiers/demande.html.haml', dossier: dossier, demande_seen_at: nil, profile: 'usager' }
subject { render 'shared/dossiers/demande', dossier: dossier, demande_seen_at: nil, profile: 'usager' }
context 'when dossier was created by an etablissement' do
let(:etablissement) { create(:etablissement) }

View file

@ -1,10 +1,10 @@
describe 'shared/dossiers/edit.html.haml', type: :view do
describe 'shared/dossiers/edit', type: :view do
before do
allow(controller).to receive(:current_user).and_return(dossier.user)
allow(view).to receive(:administrateur_signed_in?).and_return(false)
end
subject { render 'shared/dossiers/edit.html.haml', dossier: dossier, apercu: false }
subject { render 'shared/dossiers/edit', dossier: dossier, apercu: false }
context 'when there are some champs' do
let(:dossier) { create(:dossier) }

View file

@ -1,4 +1,4 @@
describe 'dossiers/show/header.html.haml', type: :view do
describe 'dossiers/show/header', type: :view do
let(:procedure) { create(:procedure, :discarded) }
let(:dossier) { create(:dossier, state: "brouillon", procedure: procedure) }
let(:user) { dossier.user }
@ -7,7 +7,7 @@ describe 'dossiers/show/header.html.haml', type: :view do
sign_in user
end
subject! { render 'shared/dossiers/header.html.haml', dossier: dossier }
subject! { render 'shared/dossiers/header', dossier: dossier }
context "when the procedure is discarded with a dossier en brouillon" do
it 'affiche que la démarche est supprimée' do

View file

@ -1,5 +1,5 @@
describe 'shared/dossiers/identite_entreprise.html.haml', type: :view do
before { render 'shared/dossiers/identite_entreprise.html.haml', etablissement: etablissement, profile: 'usager' }
describe 'shared/dossiers/identite_entreprise', type: :view do
before { render 'shared/dossiers/identite_entreprise', etablissement: etablissement, profile: 'usager' }
context "there is an association" do
let(:etablissement) { create(:etablissement, :is_association) }

View file

@ -1,4 +1,4 @@
describe 'users/procedure_footer.html.haml', type: :view do
describe 'users/procedure_footer', type: :view do
let(:service) { create(:service) }
let(:dossier) {
dossier = create(:dossier)
@ -6,7 +6,7 @@ describe 'users/procedure_footer.html.haml', type: :view do
return dossier
}
subject { render 'users/procedure_footer.html.haml', procedure: dossier.procedure, dossier: dossier }
subject { render 'users/procedure_footer', procedure: dossier.procedure, dossier: dossier }
it "affiche les informations de contact" do
expect(subject).to have_text(service.nom)

View file

@ -1,9 +1,9 @@
describe 'users/dossiers/dossier_actions.html.haml', type: :view do
describe 'users/dossiers/dossier_actions', type: :view do
let(:procedure) { create(:procedure, :published) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
let(:user) { dossier.user }
subject { render 'users/dossiers/dossier_actions.html.haml', dossier: dossier, current_user: user }
subject { render 'users/dossiers/dossier_actions', dossier: dossier, current_user: user }
it { is_expected.to have_link('Commencer un autre dossier', href: commencer_url(path: procedure.path)) }
it { is_expected.to have_link('Supprimer le dossier', href: dossier_path(dossier)) }

View file

@ -1,4 +1,4 @@
describe 'users/dossiers/expiration_banner.html.haml', type: :view do
describe 'users/dossiers/expiration_banner', type: :view do
include DossierHelper
let(:duree_conservation_dossiers_dans_ds) { 3 }
let(:dossier) do
@ -11,7 +11,7 @@ describe 'users/dossiers/expiration_banner.html.haml', type: :view do
end
let(:i18n_key_state) { state }
subject do
render('users/dossiers/expiration_banner.html.haml',
render('users/dossiers/expiration_banner',
dossier: dossier,
current_user: build(:user))
end

View file

@ -1,4 +1,4 @@
describe 'users/dossiers/brouillon.html.haml', type: :view do
describe 'users/dossiers/brouillon', type: :view do
let(:procedure) { create(:procedure, :with_type_de_champ, :with_notice, :with_service) }
let(:dossier) { create(:dossier, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
let(:footer) { view.content_for(:footer) }

View file

@ -1,4 +1,4 @@
describe 'users/dossiers/demande.html.haml', type: :view do
describe 'users/dossiers/demande', type: :view do
let(:procedure) { create(:procedure, :published, :with_type_de_champ, :with_type_de_champ_private) }
let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure) }

View file

@ -1,4 +1,4 @@
describe 'users/dossiers/etablissement.html.haml', type: :view do
describe 'users/dossiers/etablissement', type: :view do
let(:etablissement) { create(:etablissement, :with_exercices, siret: "12345678900001") }
let(:dossier) { create(:dossier, etablissement: etablissement) }
let(:footer) { view.content_for(:footer) }

View file

@ -1,4 +1,4 @@
describe 'users/dossiers/identite.html.haml', type: :view do
describe 'users/dossiers/identite', type: :view do
let(:procedure) { create(:simple_procedure, :for_individual) }
let(:dossier) { create(:dossier, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }

View file

@ -1,4 +1,4 @@
describe 'users/dossiers/index.html.haml', type: :view do
describe 'users/dossiers/index', type: :view do
let(:user) { create(:user) }
let(:dossier_brouillon) { create(:dossier, state: Dossier.states.fetch(:brouillon), user: user) }
let(:dossier_en_construction) { create(:dossier, state: Dossier.states.fetch(:en_construction), user: user) }

View file

@ -1,4 +1,4 @@
describe 'users/dossiers/papertrail.pdf.prawn', type: :view do
describe 'users/dossiers/papertrail', type: :view do
before do
assign(:dossier, dossier)
end

View file

@ -1,4 +1,4 @@
describe 'users/dossiers/show.html.haml', type: :view do
describe 'users/dossiers/show', type: :view do
let(:dossier) { create(:dossier, :en_construction) }
before do

View file

@ -1,4 +1,4 @@
describe 'users/dossiers/show/header.html.haml', type: :view do
describe 'users/dossiers/show/header', type: :view do
let(:dossier) { create(:dossier, :en_construction, procedure: create(:procedure)) }
let(:user) { dossier.user }
@ -6,7 +6,7 @@ describe 'users/dossiers/show/header.html.haml', type: :view do
sign_in user
end
subject! { render 'users/dossiers/show/header.html.haml', dossier: dossier }
subject! { render 'users/dossiers/show/header', dossier: dossier }
it 'affiche les informations du dossier' do
expect(rendered).to have_text(dossier.procedure.libelle)
@ -36,7 +36,7 @@ describe 'users/dossiers/show/header.html.haml', type: :view do
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
before do
render 'users/dossiers/show/header.html.haml', dossier: dossier
render 'users/dossiers/show/header', dossier: dossier
end
it 'affiche que la démarche est supprimée' do
@ -59,7 +59,7 @@ describe 'users/dossiers/show/header.html.haml', type: :view do
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
before do
render 'users/dossiers/show/header.html.haml', dossier: dossier
render 'users/dossiers/show/header', dossier: dossier
end
it 'affiche que la démarche est supprimée' do

View file

@ -1,7 +1,7 @@
describe 'users/dossiers/show/_status_overview.html.haml', type: :view do
describe 'users/dossiers/show/_status_overview', type: :view do
before { allow(dossier.procedure).to receive(:usual_traitement_time_for_recent_dossiers).and_return(1.day) }
subject! { render 'users/dossiers/show/status_overview.html.haml', dossier: dossier }
subject! { render 'users/dossiers/show/status_overview', dossier: dossier }
matcher :have_timeline_item do |selector|
match do |rendered|

View file

@ -1,4 +1,4 @@
describe 'users/dossiers/siret.html.haml', type: :view do
describe 'users/dossiers/siret', type: :view do
let(:dossier) { create(:dossier) }
before do

View file

@ -1,4 +1,4 @@
describe 'users/sessions/new.html.haml', type: :view do
describe 'users/sessions/new', type: :view do
let(:dossier) { create :dossier }
before(:each) do

View file

@ -1,4 +1,4 @@
describe 'users/statistiques/show.html.haml', type: :view do
describe 'users/statistiques/show', type: :view do
let(:procedure) { create(:procedure) }
before do