Merge pull request #6425 from betagouv/main

2021-08-27-01
This commit is contained in:
Paul Chavard 2021-08-27 10:20:09 +02:00 committed by GitHub
commit ee1d8b1a3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 470 additions and 114 deletions

View file

@ -234,6 +234,10 @@ $header-mobile-breakpoint: 550px;
display: flex; display: flex;
color: $black; color: $black;
&.active {
font-weight: bold;
}
&:hover { &:hover {
background: $light-grey; background: $light-grey;
} }

View file

@ -406,7 +406,7 @@ interface Demandeur {
} }
""" """
Une demarche Une démarche
""" """
type Demarche { type Demarche {
annotationDescriptors: [ChampDescriptor!]! annotationDescriptors: [ChampDescriptor!]!
@ -438,7 +438,7 @@ type Demarche {
datePublication: ISO8601DateTime datePublication: ISO8601DateTime
""" """
Létat de dossier pour une démarche déclarative Pour une démarche déclarative, état cible des dossiers à valider automatiquement
""" """
declarative: DossierDeclarativeState declarative: DossierDeclarativeState
@ -551,7 +551,7 @@ type Demarche {
id: ID! id: ID!
""" """
Le numero de la démarche. Numero de la démarche.
""" """
number: Int! number: Int!
publishedRevision: Revision publishedRevision: Revision
@ -559,12 +559,70 @@ type Demarche {
service: Service! service: Service!
""" """
Létat de la démarche. État de la démarche.
""" """
state: DemarcheState! state: DemarcheState!
""" """
Le titre de la démarche. Titre de la démarche.
"""
title: String!
}
"""
Une démarche (métadonnées)
Ceci est une version abrégée du type `Demarche`, qui nexpose que les métadonnées.
Cela évite laccès récursif aux dossiers.
"""
type DemarcheDescriptor {
"""
Date de la création.
"""
dateCreation: ISO8601DateTime!
"""
Date de la dépublication.
"""
dateDepublication: ISO8601DateTime
"""
Date de la dernière modification.
"""
dateDerniereModification: ISO8601DateTime!
"""
Date de la fermeture.
"""
dateFermeture: ISO8601DateTime
"""
Date de la publication.
"""
datePublication: ISO8601DateTime
"""
Pour une démarche déclarative, état cible des dossiers à valider automatiquement
"""
declarative: DossierDeclarativeState
"""
Description de la démarche.
"""
description: String!
id: ID!
"""
Numero de la démarche.
"""
number: Int!
"""
État de la démarche.
"""
state: DemarcheState!
"""
Titre de la démarche.
""" """
title: String! title: String!
} }
@ -650,6 +708,7 @@ type Dossier {
""" """
dateTraitement: ISO8601DateTime dateTraitement: ISO8601DateTime
demandeur: Demandeur! demandeur: Demandeur!
demarche: DemarcheDescriptor!
""" """
LURL du GeoJSON contenant les données cartographiques du dossier. LURL du GeoJSON contenant les données cartographiques du dossier.

View file

@ -0,0 +1,24 @@
module Types
class DemarcheDescriptorType < Types::BaseObject
description "Une démarche (métadonnées)
Ceci est une version abrégée du type `Demarche`, qui nexpose que les métadonnées.
Cela évite laccès récursif aux dossiers."
global_id_field :id
field :number, Int, "Numero de la démarche.", null: false, method: :id
field :title, String, "Titre de la démarche.", null: false, method: :libelle
field :description, String, "Description de la démarche.", null: false
field :state, Types::DemarcheType::DemarcheState, "État de la démarche.", null: false
field :declarative, Types::DemarcheType::DossierDeclarativeState, "Pour une démarche déclarative, état cible des dossiers à valider automatiquement", null: true, method: :declarative_with_state
field :date_creation, GraphQL::Types::ISO8601DateTime, "Date de la création.", null: false, method: :created_at
field :date_publication, GraphQL::Types::ISO8601DateTime, "Date de la publication.", null: true, method: :published_at
field :date_derniere_modification, GraphQL::Types::ISO8601DateTime, "Date de la dernière modification.", null: false, method: :updated_at
field :date_depublication, GraphQL::Types::ISO8601DateTime, "Date de la dépublication.", null: true, method: :unpublished_at
field :date_fermeture, GraphQL::Types::ISO8601DateTime, "Date de la fermeture.", null: true, method: :closed_at
def state
object.aasm.current_state
end
end
end

View file

@ -14,14 +14,14 @@ module Types
end end
end end
description "Une demarche" description "Une démarche"
global_id_field :id global_id_field :id
field :number, Int, "Le numero de la démarche.", null: false, method: :id field :number, Int, "Numero de la démarche.", null: false, method: :id
field :title, String, "Le titre de la démarche.", null: false, method: :libelle field :title, String, "Titre de la démarche.", null: false, method: :libelle
field :description, String, "Description de la démarche.", null: false field :description, String, "Description de la démarche.", null: false
field :state, DemarcheState, "Létat de la démarche.", null: false field :state, DemarcheState, "État de la démarche.", null: false
field :declarative, DossierDeclarativeState, "Létat de dossier pour une démarche déclarative", null: true, method: :declarative_with_state field :declarative, DossierDeclarativeState, "Pour une démarche déclarative, état cible des dossiers à valider automatiquement", null: true, method: :declarative_with_state
field :date_creation, GraphQL::Types::ISO8601DateTime, "Date de la création.", null: false, method: :created_at field :date_creation, GraphQL::Types::ISO8601DateTime, "Date de la création.", null: false, method: :created_at
field :date_publication, GraphQL::Types::ISO8601DateTime, "Date de la publication.", null: true, method: :published_at field :date_publication, GraphQL::Types::ISO8601DateTime, "Date de la publication.", null: true, method: :published_at

View file

@ -12,6 +12,8 @@ module Types
field :number, Int, "Le numero du dossier.", null: false, method: :id field :number, Int, "Le numero du dossier.", null: false, method: :id
field :state, DossierState, "Létat du dossier.", null: false field :state, DossierState, "Létat du dossier.", null: false
field :demarche, Types::DemarcheDescriptorType, null: false, method: :procedure
field :date_passage_en_construction, GraphQL::Types::ISO8601DateTime, "Date de dépôt.", null: false, method: :en_construction_at field :date_passage_en_construction, GraphQL::Types::ISO8601DateTime, "Date de dépôt.", null: false, method: :en_construction_at
field :date_passage_en_instruction, GraphQL::Types::ISO8601DateTime, "Date de passage en instruction.", null: true, method: :en_instruction_at field :date_passage_en_instruction, GraphQL::Types::ISO8601DateTime, "Date de passage en instruction.", null: true, method: :en_instruction_at
field :date_traitement, GraphQL::Types::ISO8601DateTime, "Date de traitement.", null: true, method: :processed_at field :date_traitement, GraphQL::Types::ISO8601DateTime, "Date de traitement.", null: true, method: :processed_at

View file

@ -57,7 +57,7 @@ class Dossier < ApplicationRecord
REMAINING_DAYS_BEFORE_CLOSING = 2 REMAINING_DAYS_BEFORE_CLOSING = 2
INTERVAL_BEFORE_CLOSING = "#{REMAINING_DAYS_BEFORE_CLOSING} days" INTERVAL_BEFORE_CLOSING = "#{REMAINING_DAYS_BEFORE_CLOSING} days"
INTERVAL_BEFORE_EXPIRATION = '1 month' INTERVAL_BEFORE_EXPIRATION = '2 weeks'
INTERVAL_EXPIRATION = '1 month 5 days' INTERVAL_EXPIRATION = '1 month 5 days'
has_one :etablissement, dependent: :destroy has_one :etablissement, dependent: :destroy

View file

@ -0,0 +1,21 @@
-# ugly hack to know if the mail is creation confirmation or a password change confirmation
- if @user.unconfirmed_email.nil?
- content_for(:title, 'Activate account')
%p= t(:hello, scope: [:views, :shared, :greetings])
%p
You have entered your details to create an account on #{APPLICATION_NAME}. To confirm your email and finish creating your account, select the following link:
- link = confirmation_url(@user, confirmation_token: @token, procedure_id: @procedure&.id)
= link_to(link, link)
- else
- content_for(:title, "Change email address")
%p= t(:hello, scope: [:views, :shared, :greetings])
%p
To confirm your account email change on #{APPLICATION_NAME}, select the following link:
= link_to(confirmation_url(@user, confirmation_token: @token), confirmation_url(@user, confirmation_token: @token))
= render partial: "layouts/mailers/signature"

View file

@ -2,8 +2,7 @@
- if @user.unconfirmed_email.nil? - if @user.unconfirmed_email.nil?
- content_for(:title, 'Activez votre compte') - content_for(:title, 'Activez votre compte')
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
Pour activer votre compte sur #{APPLICATION_NAME}, veuillez cliquer sur le lien suivant : Pour activer votre compte sur #{APPLICATION_NAME}, veuillez cliquer sur le lien suivant :
@ -13,8 +12,7 @@
- else - else
- content_for(:title, "Changement dadresse email") - content_for(:title, "Changement dadresse email")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
Pour confirmer votre changement dadresse email, veuillez cliquer sur le lien suivant : Pour confirmer votre changement dadresse email, veuillez cliquer sur le lien suivant :

View file

@ -0,0 +1,13 @@
- content_for(:title, 'New email address')
%p= t(:hello, scope: [:views, :shared, :greetings])
- unconfirmed_email = @resource.try(:unconfirmed_email?)
- if unconfirmed_email.present?
%p
We recieved a request to change the email address associated with your account #{@email} on #{APPLICATION_NAME}. The new email address will be #{unconfirmed_email}.
- else
%p
A change to the email address associated with your account #{@email} was made on #{APPLICATION_NAME}. You can now connect with the email address #{@resource.email}.
= render partial: "layouts/mailers/signature"

View file

@ -1,7 +1,6 @@
- content_for(:title, 'Votre nouvelle adresse email') - content_for(:title, 'Votre nouvelle adresse email')
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
- unconfirmed_email = @resource.try(:unconfirmed_email?) - unconfirmed_email = @resource.try(:unconfirmed_email?)
- if unconfirmed_email.present? - if unconfirmed_email.present?

View file

@ -0,0 +1,8 @@
- content_for(:title, 'New password')
%p= t(:hello, scope: [:views, :shared, :greetings])
%p
A request to change your password on #{APPLICATION_NAME} for the account #{@resource.email} was successfully processed.
= render partial: "layouts/mailers/signature"

View file

@ -1,7 +1,6 @@
- content_for(:title, 'Votre nouveau mot de passe') - content_for(:title, 'Votre nouveau mot de passe')
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
La demande de changement de mot de passe pour votre compte #{@resource.email} sur La demande de changement de mot de passe pour votre compte #{@resource.email} sur

View file

@ -0,0 +1,11 @@
%p= t(:hello, scope: [:views, :shared, :greetings])
%p
Someone has requested to change your account password on #{APPLICATION_NAME}. To define a new password, select the following link:
= round_button 'Change the password', edit_password_url(@resource, reset_password_token: @token), :primary
%p
If you didn't request this, please ignore this email. Your password won't change.
= render partial: "layouts/mailers/signature"

View file

@ -1,5 +1,4 @@
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
Vous avez demandé à changer votre mot de passe sur #{APPLICATION_NAME}. Pour ceci, merci de cliquer sur le lien suivant : Vous avez demandé à changer votre mot de passe sur #{APPLICATION_NAME}. Pour ceci, merci de cliquer sur le lien suivant :

View file

@ -0,0 +1,14 @@
- content_for(:title, 'Reactivate account')
%p= t(:hello, scope: [:views, :shared, :greetings])
%p
Someone made too many unsuccessful attempts to connect to your account #{@resource.email} on #{APPLICATION_NAME}.
As a security measure, we temporarily locked access to your account.
%p
To unlock access to your account, select the following link:
%p= link_to 'Unlock account', unlock_url(@resource, unlock_token: @token)
= render partial: "layouts/mailers/signature"

View file

@ -1,7 +1,6 @@
- content_for(:title, 'Réactivez votre compte') - content_for(:title, 'Réactivez votre compte')
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
Quelquun a tenté de se connecter un grand nombre de fois sans succès à votre Quelquun a tenté de se connecter un grand nombre de fois sans succès à votre

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
= t('.header', count: @deleted_dossiers.count) = t('.header', count: @deleted_dossiers.count)

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
= t('.header', count: @deleted_dossiers.count) = t('.header', count: @deleted_dossiers.count)

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
= t('.header', count: @dossier_hashes.count) = t('.header', count: @dossier_hashes.count)

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
= t('.header', count: @dossiers.count) = t('.header', count: @dossiers.count)

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
Le dossier n°#{@dossier.id} pour la démarche «&nbsp; Le dossier n°#{@dossier.id} pour la démarche «&nbsp;

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
= t('.body', dossier_id: @deleted_dossier.dossier_id, procedure: @deleted_dossier.procedure.libelle) = t('.body', dossier_id: @deleted_dossier.dossier_id, procedure: @deleted_dossier.procedure.libelle)

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
= t('.body', dossier_id: @deleted_dossier.dossier_id, procedure: @deleted_dossier.procedure.libelle) = t('.body', dossier_id: @deleted_dossier.dossier_id, procedure: @deleted_dossier.procedure.libelle)

View file

@ -1,5 +1,7 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p= t(:hello, scope: [:views, :shared, :greetings])
%p %p
= "Vous suiviez jusqu'à maintenant le dossier n°#{@dossier_id} de la démarche #{@demarche}." = "Vous suiviez jusqu'à maintenant le dossier n°#{@dossier_id} de la démarche #{@demarche}."
Lusager a modifié le groupe de routage. Son dossier appartient maintenant à un groupe instructeur dont vous ne faites pas partie. Lusager a modifié le groupe de routage. Son dossier appartient maintenant à un groupe instructeur dont vous ne faites pas partie.

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
= t('.body_html', dossier_id: @deleted_dossier.dossier_id, libelle_demarche: @deleted_dossier.procedure.libelle, deleted_dossiers_link: dossiers_url(statut: 'dossiers-supprimes')) = t('.body_html', dossier_id: @deleted_dossier.dossier_id, libelle_demarche: @deleted_dossier.procedure.libelle, deleted_dossiers_link: dossiers_url(statut: 'dossiers-supprimes'))

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
- if @state == Dossier.states.fetch(:en_construction) - if @state == Dossier.states.fetch(:en_construction)

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
- if @state == Dossier.states.fetch(:en_construction) - if @state == Dossier.states.fetch(:en_construction)

View file

@ -0,0 +1,31 @@
- content_for :procedure_logo do
= render 'layouts/mailers/logo', url: @logo_url
%p= t(:hello, scope: [:views, :shared, :greetings])
- if !@dossier.brouillon?
%p
You received
%strong a new message
from the service in charge of examine your File.
%p
To read the message and answer it, select the following link:
= round_button('Read the message', messagerie_dossier_url(@dossier), :primary)
- else
%p
You received
%strong a new message
from the service in charge of examine the File you started a draft for on the procedure #{@dossier.procedure.libelle}.
%p{ style: "padding: 8px; color: #333333; background-color: #EEEEEE; font-size: 14px;" }
= @body
%p
If you chose to contact the service, please use the email available below in the page.
= round_button('Open the File', dossier_url(@dossier), :primary)
= render 'layouts/mailers/signature', service: @service
- content_for :footer do
= render 'layouts/mailers/service_footer', service: @service, dossier: @dossier

View file

@ -1,8 +1,7 @@
- content_for :procedure_logo do - content_for :procedure_logo do
= render 'layouts/mailers/logo', url: @logo_url = render 'layouts/mailers/logo', url: @logo_url
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
- if !@dossier.brouillon? - if !@dossier.brouillon?
%p %p

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
= t('.body', dossier_id: @dossier.id, libelle_demarche: @dossier.procedure.libelle) = t('.body', dossier_id: @dossier.id, libelle_demarche: @dossier.procedure.libelle)

View file

@ -1,7 +1,6 @@
- content_for(:title, "#{@subject}") - content_for(:title, "#{@subject}")
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
= t('.body', dossier_id: @dossier.id, libelle_demarche: @dossier.procedure.libelle) = t('.body', dossier_id: @dossier.id, libelle_demarche: @dossier.procedure.libelle)

View file

@ -0,0 +1,23 @@
- content_for :procedure_logo do
= render 'layouts/mailers/logo', url: @logo_url
%p= t(:hello, scope: [:views, :shared, :greetings])
%p
You started filling a File on the procedure:
= succeed '.' do
%strong « #{@dossier.procedure.libelle} »
%p
You can access your File, to review or complete, by clicking on the following button:
= round_button('Access your File', dossier_url(@dossier), :primary)
- if @dossier.procedure.auto_archive_on
%p
Your File needs to be submitted before #{procedure_auto_archive_datetime(@dossier.procedure)}.
= render 'layouts/mailers/signature'
- content_for :footer do
= render 'layouts/mailers/service_footer', service: @service, dossier: @dossier

View file

@ -1,8 +1,7 @@
- content_for :procedure_logo do - content_for :procedure_logo do
= render 'layouts/mailers/logo', url: @logo_url = render 'layouts/mailers/logo', url: @logo_url
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
Vous avez commencé à remplir un dossier pour la démarche Vous avez commencé à remplir un dossier pour la démarche

View file

@ -0,0 +1,21 @@
- content_for :procedure_logo do
= render 'layouts/mailers/logo', url: @logo_url
%p= t(:hello, scope: [:views, :shared, :greetings])
%p
Your File will be reexamined. All previous decisions are void.
To see the File created on procedure
%strong= @dossier.procedure.libelle
, select the following link:
= link_to dossier_url(@dossier), dossier_url(@dossier), target: '_blank', rel: 'noopener'
- if @dossier.procedure.service.present?
%p
In order to get more details about the decision to reexamin, please contact the following service:
= mail_to @dossier.procedure.service.email, @dossier.procedure.service.email
= render 'layouts/mailers/signature'
- content_for :footer do
= render 'layouts/mailers/service_footer', service: @service, dossier: @dossier

View file

@ -1,8 +1,7 @@
- content_for :procedure_logo do - content_for :procedure_logo do
= render 'layouts/mailers/logo', url: @logo_url = render 'layouts/mailers/logo', url: @logo_url
%p %p= t(:hello, scope: [:views, :shared, :greetings])
Bonjour,
%p %p
Votre dossier va être réexaminé, la précédente décision sur ce dossier est caduque. Votre dossier va être réexaminé, la précédente décision sur ce dossier est caduque.

View file

@ -1,11 +1,11 @@
.dropdown.locale-dropdown.header-menu-opener .dropdown.locale-dropdown.header-menu-opener
%button.button.dropdown-button.icon-only.header-menu-button{ title: "Translate", aria: { expanded: 'false', controls: 'locale_menu' } } %button.button.dropdown-button.icon-only.header-menu-button{ title: t('.languages'), aria: { expanded: 'false', controls: 'locale_menu' } }
.hidden Translate .hidden t('.languages')
= image_tag "icons/translate-icon.svg", alt: 'Translate', width: 24, height: 24, lazy: true, aria: { hidden: true } = image_tag "icons/translate-icon.svg", alt: t('.languages'), width: 24, height: 24, lazy: true, aria: { hidden: true }
%ul.header-menu.dropdown-content %ul.header-menu.dropdown-content
%li %li
= link_to save_locale_path(locale: :en), method: :post, class: "menu-item menu-link" do = active_link_to save_locale_path(locale: :fr), method: :post, class: "menu-item menu-link", active: I18n.locale == :fr do
EN English Français
%li %li
= link_to save_locale_path(locale: :fr), method: :post, class: "menu-item menu-link" do = active_link_to save_locale_path(locale: :en), method: :post, class: "menu-item menu-link", active: I18n.locale == :en do
FR français English

View file

@ -2,8 +2,8 @@
= image_tag "landing/hero/dematerialiser.svg", class: "paperless-logo", alt: "moins de papier" = image_tag "landing/hero/dematerialiser.svg", class: "paperless-logo", alt: "moins de papier"
.baseline.center .baseline.center
%p %p
%span.simple= t('views.layouts.commencer.no_procedure.line1') %span.simple= t('.line1')
%br %br
= t('views.layouts.commencer.no_procedure.line2') = t('.line2')
%br %br
= t('views.layouts.commencer.no_procedure.line3') = t('.line3')

View file

@ -1,5 +1,5 @@
%p %p
Bonne journée, = t(:best_regards, scope: [:views, :shared, :greetings])
%br %br
- if defined?(service) && service && service.nom.present? - if defined?(service) && service && service.nom.present?
= service.nom = service.nom

View file

@ -4,10 +4,10 @@
- variant = (index == 0 ? :primary : :secondary) - variant = (index == 0 ? :primary : :secondary)
- case action - case action
- when MailTemplateConcern::Actions::SHOW - when MailTemplateConcern::Actions::SHOW
= round_button('Consulter mon dossier', dossier_url(@dossier), variant) = round_button(t(:access, scope: [:layouts, :notifications, :actions]), dossier_url(@dossier), variant)
- when MailTemplateConcern::Actions::ASK_QUESTION - when MailTemplateConcern::Actions::ASK_QUESTION
= round_button('Jai une question', messagerie_dossier_url(@dossier), variant) = round_button(t(:question, scope: [:layouts, :notifications, :actions]), messagerie_dossier_url(@dossier), variant)
- when MailTemplateConcern::Actions::REPLY - when MailTemplateConcern::Actions::REPLY
= round_button('Répondre à ce message', messagerie_dossier_url(@dossier), variant) = round_button(t(:reply, scope: [:layouts, :notifications, :actions]), messagerie_dossier_url(@dossier), variant)
= vertical_margin(5) = vertical_margin(5)

View file

@ -11,9 +11,9 @@
%h1= t('devise.passwords.new.forgot_your_password') %h1= t('devise.passwords.new.forgot_your_password')
%p.notice= t('views.passwords.new.send_me_reset_password_instructions') %p.notice= t('devise.passwords.new.send_me_reset_password_instructions')
= f.label :email, 'Email' = f.label :email, 'Email'
= f.email_field :email, autofocus: true = f.email_field :email, autofocus: true
= f.submit 'Demander un nouveau mot de passe', class: 'button expand primary' = f.submit t('devise.passwords.new.request_new_password'), class: 'button expand primary'

View file

@ -0,0 +1,5 @@
en:
devise:
passwords:
new:
request_new_password: Request new password

View file

@ -0,0 +1,5 @@
fr:
devise:
passwords:
new:
request_new_password: Demander un nouveau mot de passe

View file

@ -45,6 +45,19 @@ en:
commentaire: commentaire:
send_message_to_instructeur: "Send a message to the instructor" send_message_to_instructeur: "Send a message to the instructor"
reply_in_mailbox: "Reply in mailbox" reply_in_mailbox: "Reply in mailbox"
layouts:
commencer:
no_procedure:
line1: A simple tool
line2: to manage dematerialized
line3: administrative forms.
locale_dropdown:
languages: "Languages"
notifications:
actions:
access: View your File
question: I have a question
reply: Reply to this message
views: views:
commencer: commencer:
show: show:
@ -85,12 +98,6 @@ en:
want_to_withdraw_permission: "Would you like to withdraw the permission?" want_to_withdraw_permission: "Would you like to withdraw the permission?"
edit_dossier: "These people can edit this file." edit_dossier: "These people can edit this file."
submit_dossier_yourself: "You must submit the file yourself when it is complete." submit_dossier_yourself: "You must submit the file yourself when it is complete."
layouts:
commencer:
no_procedure:
line1: A simple tool
line2: to manage dematerialized
line3: administrative forms.
pagination: pagination:
next: Next next: Next
last: Last last: Last
@ -98,6 +105,9 @@ en:
first: First first: First
truncate: '&hellip;' truncate: '&hellip;'
shared: shared:
greetings:
hello: Dear Sir or Madam,
best_regards: Best Regards,
dossiers: dossiers:
edit: edit:
autosave: Your file is automatically saved after each modification. You can close the window at any time and pick up where you left off later. autosave: Your file is automatically saved after each modification. You can close the window at any time and pick up where you left off later.

View file

@ -35,6 +35,20 @@ fr:
commentaire: commentaire:
send_message_to_instructeur: "Envoyer un message à linstructeur" send_message_to_instructeur: "Envoyer un message à linstructeur"
reply_in_mailbox: "Répondre dans la messagerie." reply_in_mailbox: "Répondre dans la messagerie."
layouts:
commencer:
no_procedure:
line1: Un outil simple
line2: pour gérer les formulaires
line3: administratifs dématérialisés.
locale_dropdown:
languages: "Langues"
notifications:
actions:
access: Consulter mon dossier
question: Jai une question
reply: Répondre à ce message
views: views:
commencer: commencer:
show: show:
@ -76,12 +90,6 @@ fr:
want_to_withdraw_permission: "Souhaitez-vous supprimer lautorisation ?" want_to_withdraw_permission: "Souhaitez-vous supprimer lautorisation ?"
edit_dossier: "Ces personnes peuvent modifier ce dossier." edit_dossier: "Ces personnes peuvent modifier ce dossier."
submit_dossier_yourself: "Une fois le dossier complet, vous devez le déposer vous-même." submit_dossier_yourself: "Une fois le dossier complet, vous devez le déposer vous-même."
layouts:
commencer:
no_procedure:
line1: Un outil simple
line2: pour gérer les formulaires
line3: administratifs dématérialisés.
pagination: pagination:
next: Suivant next: Suivant
last: Dernier last: Dernier
@ -89,6 +97,9 @@ fr:
first: Premier first: Premier
truncate: '&hellip;' truncate: '&hellip;'
shared: shared:
greetings:
hello: Bonjour,
best_regards: Bonne journée,
dossiers: dossiers:
edit: edit:
autosave: Votre dossier est enregistré automatiquement après chaque modification. Vous pouvez à tout moment fermer la fenêtre et reprendre plus tard là où vous en étiez. autosave: Votre dossier est enregistré automatiquement après chaque modification. Vous pouvez à tout moment fermer la fenêtre et reprendre plus tard là où vous en étiez.

View file

@ -14,8 +14,8 @@ fr:
one: "Le dossier suivant dont le traitement est terminé sera bientôt automatiquement supprimé :" one: "Le dossier suivant dont le traitement est terminé sera bientôt automatiquement supprimé :"
other: "Les dossiers suivant dont le traitement est terminé seront bientôt automatiquement supprimés :" other: "Les dossiers suivant dont le traitement est terminé seront bientôt automatiquement supprimés :"
footer_en_construction: footer_en_construction:
one: "Vous avez <b>un mois</b> pour commencer linstruction du dossier." one: "Vous avez <b>deux semaines</b> pour commencer linstruction du dossier."
other: "Vous avez <b>un mois</b> pour commencer linstruction des dossiers." other: "Vous avez <b>deux semaines</b> pour commencer linstruction des dossiers."
footer_termine: footer_termine:
one: "Vous avez <b>un mois</b> pour archiver le dossier." one: "Vous avez <b>deux semaines</b> pour archiver le dossier."
other: "Vous avez <b>un mois</b> pour archiver les dossiers." other: "Vous avez <b>deux semaines</b> pour archiver les dossiers."

View file

@ -14,8 +14,8 @@ fr:
one: "Afin de limiter la conservation de vos données personnelles, le dossier suivant dont le traitement est terminé sera bientôt automatiquement supprimé :" one: "Afin de limiter la conservation de vos données personnelles, le dossier suivant dont le traitement est terminé sera bientôt automatiquement supprimé :"
other: "Afin de limiter la conservation de vos données personnelles, les dossiers suivant dont le traitement est terminé seront bientôt automatiquement supprimés :" other: "Afin de limiter la conservation de vos données personnelles, les dossiers suivant dont le traitement est terminé seront bientôt automatiquement supprimés :"
footer: footer:
one: "Vous pouvez retrouver votre dossier pendant encore <b>un mois</b>. Vous navez rien à faire." one: "Vous pouvez retrouver votre dossier pendant encore <b>deux semaines</b>. Vous navez rien à faire."
other: "Vous pouvez retrouver vos dossiers pendant encore <b>un mois</b>. Vous navez rien à faire." other: "Vous pouvez retrouver vos dossiers pendant encore <b>deux semaines</b>. Vous navez rien à faire."
footer_en_construction: footer_en_construction:
one: "Si vous souhaitez conserver votre dossier plus longtemps, vous pouvez <b>prolonger sa durée de conservation</b> dans linterface." one: "Si vous souhaitez conserver votre dossier plus longtemps, vous pouvez <b>prolonger sa durée de conservation</b> dans linterface."
other: "Si vous souhaitez conserver vos dossiers plus longtemps, vous pouvez <b>prolonger leur durée de conservation</b> au cas par cas dans linterface." other: "Si vous souhaitez conserver vos dossiers plus longtemps, vous pouvez <b>prolonger leur durée de conservation</b> au cas par cas dans linterface."

View file

@ -0,0 +1,24 @@
namespace :after_party do
desc 'Deployment task: remove_migration_status_on_filters'
task remove_migration_status_on_filters: :environment do
rake_puts "Running deploy task 'remove_migration_status_on_filters'"
# In a9a4f6e2a801b19b127aae8eaec0d1f384b1a53a, a task to migrate ProcedurePresentation's filters
# was added.
# This task added a "migrated: true" key to all migrated filters.
#
# Now that this task has run, we can safely remove the extra key.
procedure_presentations = ProcedurePresentation.where("filters -> 'migrated' IS NOT NULL")
progress = ProgressReport.new(procedure_presentations.count)
procedure_presentations.find_each do |pp|
pp.update_column(:filters, pp.filters.except('migrated'))
progress.inc
end
progress.finish
AfterParty::TaskRecord
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
end
end

View file

@ -15,6 +15,17 @@ def rake_print(*args)
end end
end end
# Display progress of a long-running Rake task.
#
# Usage:
#
# ```
# progress = ProgressReport.new(100)
# (0..100).times do
# progress.inc
# end
# progress.finish
# ````
class ProgressReport class ProgressReport
def initialize(total) def initialize(total)
@start = Time.zone.now @start = Time.zone.now

View file

@ -310,6 +310,11 @@ describe API::V2::GraphqlController do
motivationAttachment { motivationAttachment {
url url
} }
demarche {
number
title
state
}
usager { usager {
id id
email email
@ -382,6 +387,11 @@ describe API::V2::GraphqlController do
dateTraitement: nil, dateTraitement: nil,
motivation: nil, motivation: nil,
motivationAttachment: nil, motivationAttachment: nil,
demarche: {
number: dossier.procedure.id,
title: dossier.procedure.libelle,
state: 'publiee'
},
usager: { usager: {
id: dossier.user.to_typed_id, id: dossier.user.to_typed_id,
email: dossier.user.email email: dossier.user.email

View file

@ -1,4 +1,4 @@
xdescribe Manager::AdministrateursController, type: :controller do describe Manager::AdministrateursController, type: :controller do
let(:super_admin) { create(:super_admin) } let(:super_admin) { create(:super_admin) }
let(:administrateur) { create(:administrateur) } let(:administrateur) { create(:administrateur) }

View file

@ -7,8 +7,8 @@ feature 'Accessing the website in different languages:' do
visit new_user_session_path visit new_user_session_path
expect(page).to have_text('Connectez-vous') expect(page).to have_text('Connectez-vous')
click_on 'Translate' click_on 'Langues'
click_on 'EN English' click_on 'English'
# The page is now in English # The page is now in English
expect(page).to have_text('Sign in') expect(page).to have_text('Sign in')

View file

@ -0,0 +1,68 @@
describe '20201001161931_migrate_filters_to_use_stable_id' do
let(:rake_task) { Rake::Task['after_party:remove_migration_status_on_filters'] }
let(:procedure) { create(:simple_procedure) }
let(:instructeur_1) { create(:instructeur) }
let(:instructeur_2) { create(:instructeur) }
let(:assign_to_1) { create(:assign_to, procedure: procedure, instructeur: instructeur_1) }
let(:assign_to_2) { create(:assign_to, procedure: procedure, instructeur: instructeur_2) }
let(:procedure_presentation_with_migration) { create(:procedure_presentation, assign_to: assign_to_1, filters: filters.merge('migrated': true)) }
let(:procedure_presentation_without_migration) { create(:procedure_presentation, assign_to: assign_to_2, filters: filters) }
let(:filters) do
{ "suivis" => [{ "table" => "user", "column" => "email", "value" => "test@example.com" }] }
end
subject(:run_task) do
procedure_presentation_with_migration
procedure_presentation_without_migration
rake_task.invoke
procedure_presentation_with_migration.reload
procedure_presentation_without_migration.reload
end
after { rake_task.reenable }
context 'when the procedure presentation has a "migrated" key' do
it 'removes the "migrated" key' do
run_task
expect(procedure_presentation_with_migration.filters).not_to have_key('migrated')
end
it 'leaves other keys unchanged' do
run_task
expect(procedure_presentation_with_migration.filters['suivis']).to be_present
end
end
context 'when the procedure presentation doesnt have a "migrated" key' do
it 'leaves keys unchanged' do
run_task
expect(procedure_presentation_without_migration.filters['suivis']).to be_present
end
end
context 'when the procedure presentation is invalid' do
before do
procedure_presentation_with_migration.update_column(
:sort,
{ table: 'invalid-table', column: 'invalid-column', order: 'invalid-order' }
)
end
it 'removes the "migrated" key properly' do
run_task
expect(procedure_presentation_with_migration).not_to be_valid
expect(procedure_presentation_with_migration.filters).not_to have_key('migrated')
end
it 'leaves the other keys unchanged' do
run_task
expect(procedure_presentation_without_migration.filters['suivis']).to be_present
end
end
end

View file

@ -151,7 +151,7 @@ RSpec.describe DossierMailer, type: :mailer do
it { expect(subject.body).to include("#{dossier.id} ") } it { expect(subject.body).to include("#{dossier.id} ") }
it { expect(subject.body).to include(dossier.procedure.libelle) } it { expect(subject.body).to include(dossier.procedure.libelle) }
it { expect(subject.body).to include("PDF") } it { expect(subject.body).to include("PDF") }
it { expect(subject.body).to include("Vous avez <b>un mois</b> pour commencer linstruction du dossier.") } it { expect(subject.body).to include("Vous avez <b>deux semaines</b> pour commencer linstruction du dossier.") }
end end
describe 'termine' do describe 'termine' do
@ -163,7 +163,7 @@ RSpec.describe DossierMailer, type: :mailer do
it { expect(subject.body).to include("#{dossier.id} ") } it { expect(subject.body).to include("#{dossier.id} ") }
it { expect(subject.body).to include(dossier.procedure.libelle) } it { expect(subject.body).to include(dossier.procedure.libelle) }
it { expect(subject.body).to include("PDF") } it { expect(subject.body).to include("PDF") }
it { expect(subject.body).to include("Vous avez <b>un mois</b> pour archiver le dossier.") } it { expect(subject.body).to include("Vous avez <b>deux semaines</b> pour archiver le dossier.") }
end end
end end
@ -178,7 +178,7 @@ RSpec.describe DossierMailer, type: :mailer do
it { expect(subject.body).to include("#{dossier.id} ") } it { expect(subject.body).to include("#{dossier.id} ") }
it { expect(subject.body).to include(dossier.procedure.libelle) } it { expect(subject.body).to include(dossier.procedure.libelle) }
it { expect(subject.body).to include("PDF") } it { expect(subject.body).to include("PDF") }
it { expect(subject.body).to include("Vous pouvez retrouver votre dossier pendant encore <b>un mois</b>. Vous navez rien à faire.") } it { expect(subject.body).to include("Vous pouvez retrouver votre dossier pendant encore <b>deux semaines</b>. Vous navez rien à faire.") }
it { expect(subject.body).to include("Si vous souhaitez conserver votre dossier plus longtemps, vous pouvez <b>prolonger sa durée de conservation</b> dans linterface.") } it { expect(subject.body).to include("Si vous souhaitez conserver votre dossier plus longtemps, vous pouvez <b>prolonger sa durée de conservation</b> dans linterface.") }
end end
@ -192,7 +192,7 @@ RSpec.describe DossierMailer, type: :mailer do
it { expect(subject.body).to include("#{dossier.id} ") } it { expect(subject.body).to include("#{dossier.id} ") }
it { expect(subject.body).to include(dossier.procedure.libelle) } it { expect(subject.body).to include(dossier.procedure.libelle) }
it { expect(subject.body).to include("PDF") } it { expect(subject.body).to include("PDF") }
it { expect(subject.body).to include("Vous pouvez retrouver votre dossier pendant encore <b>un mois</b>. Vous navez rien à faire.") } it { expect(subject.body).to include("Vous pouvez retrouver votre dossier pendant encore <b>deux semaines</b>. Vous navez rien à faire.") }
end end
end end

View file

@ -40,7 +40,7 @@ describe Dossier do
describe 'brouillon_close_to_expiration' do describe 'brouillon_close_to_expiration' do
let(:procedure) { create(:procedure, :published, duree_conservation_dossiers_dans_ds: 6) } let(:procedure) { create(:procedure, :published, duree_conservation_dossiers_dans_ds: 6) }
let!(:young_dossier) { create(:dossier, :en_construction, procedure: procedure) } let!(:young_dossier) { create(:dossier, :en_construction, procedure: procedure) }
let!(:expiring_dossier) { create(:dossier, created_at: 170.days.ago, procedure: procedure) } let!(:expiring_dossier) { create(:dossier, created_at: 175.days.ago, procedure: procedure) }
let!(:just_expired_dossier) { create(:dossier, created_at: (6.months + 1.hour + 10.seconds).ago, procedure: procedure) } let!(:just_expired_dossier) { create(:dossier, created_at: (6.months + 1.hour + 10.seconds).ago, procedure: procedure) }
let!(:long_expired_dossier) { create(:dossier, created_at: 1.year.ago, procedure: procedure) } let!(:long_expired_dossier) { create(:dossier, created_at: 1.year.ago, procedure: procedure) }
@ -66,7 +66,7 @@ describe Dossier do
describe 'en_construction_close_to_expiration' do describe 'en_construction_close_to_expiration' do
let(:procedure) { create(:procedure, :published, duree_conservation_dossiers_dans_ds: 6) } let(:procedure) { create(:procedure, :published, duree_conservation_dossiers_dans_ds: 6) }
let!(:young_dossier) { create(:dossier, procedure: procedure) } let!(:young_dossier) { create(:dossier, procedure: procedure) }
let!(:expiring_dossier) { create(:dossier, :en_construction, en_construction_at: 170.days.ago, procedure: procedure) } let!(:expiring_dossier) { create(:dossier, :en_construction, en_construction_at: 175.days.ago, procedure: procedure) }
let!(:just_expired_dossier) { create(:dossier, :en_construction, en_construction_at: (6.months + 1.hour + 10.seconds).ago, procedure: procedure) } let!(:just_expired_dossier) { create(:dossier, :en_construction, en_construction_at: (6.months + 1.hour + 10.seconds).ago, procedure: procedure) }
let!(:long_expired_dossier) { create(:dossier, :en_construction, en_construction_at: 1.year.ago, procedure: procedure) } let!(:long_expired_dossier) { create(:dossier, :en_construction, en_construction_at: 1.year.ago, procedure: procedure) }
@ -92,7 +92,7 @@ describe Dossier do
describe 'en_instruction_close_to_expiration' do describe 'en_instruction_close_to_expiration' do
let(:procedure) { create(:procedure, :published, duree_conservation_dossiers_dans_ds: 6) } let(:procedure) { create(:procedure, :published, duree_conservation_dossiers_dans_ds: 6) }
let!(:young_dossier) { create(:dossier, procedure: procedure) } let!(:young_dossier) { create(:dossier, procedure: procedure) }
let!(:expiring_dossier) { create(:dossier, :en_instruction, en_instruction_at: 170.days.ago, procedure: procedure) } let!(:expiring_dossier) { create(:dossier, :en_instruction, en_instruction_at: 175.days.ago, procedure: procedure) }
let!(:just_expired_dossier) { create(:dossier, :en_instruction, en_instruction_at: (6.months + 1.hour + 10.seconds).ago, procedure: procedure) } let!(:just_expired_dossier) { create(:dossier, :en_instruction, en_instruction_at: (6.months + 1.hour + 10.seconds).ago, procedure: procedure) }
let!(:long_expired_dossier) { create(:dossier, :en_instruction, en_instruction_at: 1.year.ago, procedure: procedure) } let!(:long_expired_dossier) { create(:dossier, :en_instruction, en_instruction_at: 1.year.ago, procedure: procedure) }

View file

@ -8,7 +8,7 @@ describe ExpiredDossiersDeletionService do
describe '#process_expired_dossiers_brouillon' do describe '#process_expired_dossiers_brouillon' do
let(:today) { Time.zone.now.at_midnight } let(:today) { Time.zone.now.at_midnight }
let(:date_close_to_expiration) { Date.today - procedure.duree_conservation_dossiers_dans_ds.months + 1.month } let(:date_close_to_expiration) { Date.today - procedure.duree_conservation_dossiers_dans_ds.months + 2.weeks }
let(:date_expired) { Date.today - procedure.duree_conservation_dossiers_dans_ds.months - 6.days } let(:date_expired) { Date.today - procedure.duree_conservation_dossiers_dans_ds.months - 6.days }
let(:date_not_expired) { Date.today - procedure.duree_conservation_dossiers_dans_ds.months + 2.months } let(:date_not_expired) { Date.today - procedure.duree_conservation_dossiers_dans_ds.months + 2.months }
@ -56,15 +56,15 @@ describe ExpiredDossiersDeletionService do
before { ExpiredDossiersDeletionService.send_brouillon_expiration_notices } before { ExpiredDossiersDeletionService.send_brouillon_expiration_notices }
context 'when the dossier is not closed to expiration' do context 'when the dossier is not close to expiration' do
let(:created_at) { (conservation_par_defaut - 1.month - 1.day).ago } let(:created_at) { (conservation_par_defaut - 2.weeks - 1.day).ago }
it { expect(dossier.reload.brouillon_close_to_expiration_notice_sent_at).to be_nil } it { expect(dossier.reload.brouillon_close_to_expiration_notice_sent_at).to be_nil }
it { expect(DossierMailer).not_to have_received(:notify_brouillon_near_deletion) } it { expect(DossierMailer).not_to have_received(:notify_brouillon_near_deletion) }
end end
context 'when the dossier is closed to expiration' do context 'when the dossier is close to expiration' do
let(:created_at) { (conservation_par_defaut - 1.month + 1.day).ago } let(:created_at) { (conservation_par_defaut - 2.weeks + 1.day).ago }
it { expect(dossier.reload.brouillon_close_to_expiration_notice_sent_at).not_to be_nil } it { expect(dossier.reload.brouillon_close_to_expiration_notice_sent_at).not_to be_nil }
it { expect(DossierMailer).to have_received(:notify_brouillon_near_deletion).once } it { expect(DossierMailer).to have_received(:notify_brouillon_near_deletion).once }
@ -73,8 +73,8 @@ describe ExpiredDossiersDeletionService do
end end
context 'with 2 dossiers to notice' do context 'with 2 dossiers to notice' do
let!(:dossier_1) { create(:dossier, procedure: procedure, user: user, created_at: (conservation_par_defaut - 1.month + 1.day).ago) } let!(:dossier_1) { create(:dossier, procedure: procedure, user: user, created_at: (conservation_par_defaut - 2.weeks + 1.day).ago) }
let!(:dossier_2) { create(:dossier, procedure: procedure_2, user: user, created_at: (conservation_par_defaut - 1.month + 1.day).ago) } let!(:dossier_2) { create(:dossier, procedure: procedure_2, user: user, created_at: (conservation_par_defaut - 2.weeks + 1.day).ago) }
before { ExpiredDossiersDeletionService.send_brouillon_expiration_notices } before { ExpiredDossiersDeletionService.send_brouillon_expiration_notices }
@ -146,7 +146,7 @@ describe ExpiredDossiersDeletionService do
before { ExpiredDossiersDeletionService.send_en_construction_expiration_notices } before { ExpiredDossiersDeletionService.send_en_construction_expiration_notices }
context 'when the dossier is not near deletion' do context 'when the dossier is not near deletion' do
let(:en_construction_at) { (conservation_par_defaut - 1.month - 1.day).ago } let(:en_construction_at) { (conservation_par_defaut - 2.weeks - 1.day).ago }
it { expect(dossier.reload.en_construction_close_to_expiration_notice_sent_at).to be_nil } it { expect(dossier.reload.en_construction_close_to_expiration_notice_sent_at).to be_nil }
it { expect(DossierMailer).not_to have_received(:notify_near_deletion_to_user) } it { expect(DossierMailer).not_to have_received(:notify_near_deletion_to_user) }
@ -154,7 +154,7 @@ describe ExpiredDossiersDeletionService do
end end
context 'when the dossier is near deletion' do context 'when the dossier is near deletion' do
let(:en_construction_at) { (conservation_par_defaut - 1.month + 1.day).ago } let(:en_construction_at) { (conservation_par_defaut - 2.weeks + 1.day).ago }
it { expect(dossier.reload.en_construction_close_to_expiration_notice_sent_at).not_to be_nil } it { expect(dossier.reload.en_construction_close_to_expiration_notice_sent_at).not_to be_nil }
@ -167,8 +167,8 @@ describe ExpiredDossiersDeletionService do
end end
context 'with 2 dossiers to notice' do context 'with 2 dossiers to notice' do
let!(:dossier_1) { create(:dossier, :en_construction, procedure: procedure, user: user, en_construction_at: (conservation_par_defaut - 1.month + 1.day).ago) } let!(:dossier_1) { create(:dossier, :en_construction, procedure: procedure, user: user, en_construction_at: (conservation_par_defaut - 2.weeks + 1.day).ago) }
let!(:dossier_2) { create(:dossier, :en_construction, procedure: procedure_2, user: user, en_construction_at: (conservation_par_defaut - 1.month + 1.day).ago) } let!(:dossier_2) { create(:dossier, :en_construction, procedure: procedure_2, user: user, en_construction_at: (conservation_par_defaut - 2.weeks + 1.day).ago) }
let!(:instructeur) { create(:instructeur) } let!(:instructeur) { create(:instructeur) }
@ -187,7 +187,7 @@ describe ExpiredDossiersDeletionService do
context 'when an instructeur is also administrateur' do context 'when an instructeur is also administrateur' do
let!(:administrateur) { procedure.administrateurs.first } let!(:administrateur) { procedure.administrateurs.first }
let!(:dossier) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: (conservation_par_defaut - 1.month + 1.day).ago) } let!(:dossier) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: (conservation_par_defaut - 2.weeks + 1.day).ago) }
before do before do
administrateur.instructeur.followed_dossiers << dossier administrateur.instructeur.followed_dossiers << dossier
@ -290,7 +290,7 @@ describe ExpiredDossiersDeletionService do
before { ExpiredDossiersDeletionService.send_termine_expiration_notices } before { ExpiredDossiersDeletionService.send_termine_expiration_notices }
context 'when the dossier is not near deletion' do context 'when the dossier is not near deletion' do
let(:processed_at) { (conservation_par_defaut - 1.month - 1.day).ago } let(:processed_at) { (conservation_par_defaut - 2.weeks - 1.day).ago }
it { expect(dossier.reload.termine_close_to_expiration_notice_sent_at).to be_nil } it { expect(dossier.reload.termine_close_to_expiration_notice_sent_at).to be_nil }
it { expect(DossierMailer).not_to have_received(:notify_near_deletion_to_user) } it { expect(DossierMailer).not_to have_received(:notify_near_deletion_to_user) }
@ -298,7 +298,7 @@ describe ExpiredDossiersDeletionService do
end end
context 'when the dossier is near deletion' do context 'when the dossier is near deletion' do
let(:processed_at) { (conservation_par_defaut - 1.month + 1.day).ago } let(:processed_at) { (conservation_par_defaut - 2.weeks + 1.day).ago }
it { expect(dossier.reload.termine_close_to_expiration_notice_sent_at).not_to be_nil } it { expect(dossier.reload.termine_close_to_expiration_notice_sent_at).not_to be_nil }
@ -311,8 +311,8 @@ describe ExpiredDossiersDeletionService do
end end
context 'with 2 dossiers to notice' do context 'with 2 dossiers to notice' do
let!(:dossier_1) { create(:dossier, :accepte, procedure: procedure, user: user, processed_at: (conservation_par_defaut - 1.month + 1.day).ago) } let!(:dossier_1) { create(:dossier, :accepte, procedure: procedure, user: user, processed_at: (conservation_par_defaut - 2.weeks + 1.day).ago) }
let!(:dossier_2) { create(:dossier, :accepte, procedure: procedure_2, user: user, processed_at: (conservation_par_defaut - 1.month + 1.day).ago) } let!(:dossier_2) { create(:dossier, :accepte, procedure: procedure_2, user: user, processed_at: (conservation_par_defaut - 2.weeks + 1.day).ago) }
let!(:instructeur) { create(:instructeur) } let!(:instructeur) { create(:instructeur) }
@ -331,7 +331,7 @@ describe ExpiredDossiersDeletionService do
context 'when an instructeur is also administrateur' do context 'when an instructeur is also administrateur' do
let!(:administrateur) { procedure.administrateurs.first } let!(:administrateur) { procedure.administrateurs.first }
let!(:dossier) { create(:dossier, :accepte, procedure: procedure, processed_at: (conservation_par_defaut - 1.month + 1.day).ago) } let!(:dossier) { create(:dossier, :accepte, procedure: procedure, processed_at: (conservation_par_defaut - 2.weeks + 1.day).ago) }
before do before do
administrateur.instructeur.followed_dossiers << dossier administrateur.instructeur.followed_dossiers << dossier