commit
17cc5fa819
11 changed files with 102 additions and 35 deletions
9
app/jobs/cron/purge_old_sib_mails_job.rb
Normal file
9
app/jobs/cron/purge_old_sib_mails_job.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class Cron::PurgeOldSibMailsJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at midnight"
|
||||
|
||||
def perform
|
||||
sib = Sendinblue::API.new
|
||||
day_to_delete = (Time.zone.today - 31.days).strftime("%Y-%m-%d")
|
||||
sib.delete_events(day_to_delete)
|
||||
end
|
||||
end
|
|
@ -55,6 +55,21 @@ class Sendinblue::API
|
|||
[]
|
||||
end
|
||||
|
||||
def delete_events(day, opts = {})
|
||||
client = ::SibApiV3Sdk::TransactionalEmailsApi.new
|
||||
event_opts = { start_date: day, end_date: day, limit: 100 }.merge(opts)
|
||||
while (events = client.get_email_event_report(event_opts).events).present?
|
||||
message_ids = events.map(&:message_id).uniq
|
||||
message_ids.each do |message_id|
|
||||
client.smtp_log_message_id_delete(message_id)
|
||||
end
|
||||
end
|
||||
true
|
||||
rescue ::SibApiV3Sdk::ApiError => e
|
||||
Rails.logger.error e.message
|
||||
false
|
||||
end
|
||||
|
||||
def unblock_user(email_address)
|
||||
client = ::SibApiV3Sdk::TransactionalEmailsApi.new
|
||||
client.smtp_blocked_contacts_email_delete(email_address)
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
.commencer.form
|
||||
- if !user_signed_in?
|
||||
%h2.huge-title Commencer la démarche
|
||||
%h2.huge-title= t('views.commencer.show.start_procedure')
|
||||
= render partial: 'shared/france_connect_login', locals: { url: commencer_france_connect_path(path: @procedure.path) }
|
||||
= link_to commencer_sign_up_path(path: @procedure.path), class: ['button large expand primary'] do
|
||||
Créer un compte
|
||||
= t('views.shared.account.create')
|
||||
%span.optional-on-small-screens
|
||||
#{APPLICATION_NAME}
|
||||
= link_to 'J’ai déjà un compte', commencer_sign_in_path(path: @procedure.path), class: ['button large expand']
|
||||
= link_to t('views.shared.account.already_user'), commencer_sign_in_path(path: @procedure.path), class: ['button large expand']
|
||||
|
||||
- else
|
||||
- dossiers = current_user.dossiers.where(revision: @revision.draft? ? @revision : @procedure.revisions.where.not(id: @procedure.draft_revision_id))
|
||||
|
@ -20,33 +20,29 @@
|
|||
|
||||
- elsif drafts.count == 1 && not_drafts.count == 0
|
||||
- dossier = drafts.first
|
||||
%h2.huge-title Vous avez déjà commencé à remplir un dossier
|
||||
%h2.huge-title= t('views.commencer.show.already_draft')
|
||||
%p
|
||||
Il y a <strong>#{time_ago_in_words(dossier.created_at)}</strong>,
|
||||
vous avez commencé à remplir un dossier sur la démarche « #{dossier.procedure.libelle} ».
|
||||
= link_to 'Continuer à remplir mon dossier', brouillon_dossier_path(dossier), class: ['button large expand primary']
|
||||
= link_to 'Commencer un nouveau dossier', url_for_new_dossier(@revision), class: ['button large expand']
|
||||
= t('views.commencer.show.already_draft_detail_html', time_ago: time_ago_in_words(dossier.created_at), procedure: dossier.procedure.libelle)
|
||||
= link_to t('views.commencer.show.continue_file'), brouillon_dossier_path(dossier), class: ['button large expand primary']
|
||||
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: ['button large expand']
|
||||
|
||||
- elsif not_drafts.count == 1
|
||||
- dossier = not_drafts.first
|
||||
%h2.huge-title Vous avez déjà déposé un dossier
|
||||
%h2.huge-title= t('views.commencer.show.already_not_draft')
|
||||
%p
|
||||
Il y a <strong>#{time_ago_in_words(dossier.en_construction_at)}</strong>,
|
||||
vous avez déposé un dossier sur la démarche « #{dossier.procedure.libelle} ».
|
||||
= link_to 'Voir mon dossier déposé', dossier_path(dossier), class: ['button large expand primary']
|
||||
= link_to 'Commencer un nouveau dossier', url_for_new_dossier(@revision), class: ['button large expand']
|
||||
= t('views.commencer.show.already_not_draft_detail_html', time_ago: time_ago_in_words(dossier.en_construction_at), procedure: dossier.procedure.libelle)
|
||||
= link_to t('views.commencer.show.show_my_submitted_file'), dossier_path(dossier), class: ['button large expand primary']
|
||||
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: ['button large expand']
|
||||
|
||||
- else
|
||||
%h2.huge-title= t('views.commencer.show.existing_dossiers')
|
||||
= link_to t('views.commencer.show.show_dossiers'), dossiers_path, class: ['button large expand primary']
|
||||
= link_to t('views.commencer.show.start_new_dossier'), url_for_new_dossier(@revision), class: ['button large expand']
|
||||
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: ['button large expand']
|
||||
|
||||
- if @procedure.feature_enabled?(:dossier_pdf_vide)
|
||||
- pdf_link = @revision.draft? ? commencer_dossier_vide_test_path(path: @procedure.path) : commencer_dossier_vide_path(path: @procedure.path)
|
||||
%hr
|
||||
%p
|
||||
Vous souhaitez effectuer une demande par papier ? Vous pouvez télécharger un dossier vide au format PDF,
|
||||
et l'envoyer à l’administration concernée :
|
||||
#{@procedure&.service&.nom} - #{@procedure&.service&.adresse}
|
||||
%p= t('views.commencer.show.want_empty_pdf', service: @procedure&.service&.nom, adresse: @procedure&.service&.adresse)
|
||||
|
||||
%br
|
||||
= link_to 'Télécharger un dossier vide au format PDF', pdf_link, class: ['button large expand']
|
||||
= link_to t('views.commencer.show.download_empty_pdf'), pdf_link, class: ['button large expand']
|
||||
|
|
|
@ -65,9 +65,9 @@
|
|||
- elsif request.path != new_user_session_path
|
||||
- if request.path == new_user_registration_path
|
||||
%li
|
||||
Vous avez déjà un compte ?
|
||||
= t('views.shared.account.already_user_question')
|
||||
%li
|
||||
= link_to "Connexion", new_user_session_path, class: "button secondary"
|
||||
= link_to t('views.shared.account.signin'), new_user_session_path, class: "button secondary"
|
||||
|
||||
%li
|
||||
- if dossier.present? && nav_bar_profile == :user
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
= form_for(commentaire, url: form_url, html: { class: 'form', data: { persisted_content_id: @dossier.id } }) do |f|
|
||||
= form_for(commentaire, url: form_url, html: { class: 'form', data: { persisted_content_id: @dossier.present? ? @dossier.id : "bulk-message-#{@procedure.id}" } }) do |f|
|
||||
- dossier = commentaire.dossier
|
||||
- placeholder = t('views.shared.dossiers.messages.form.write_message_to_administration_placeholder')
|
||||
- if instructeur_signed_in? || administrateur_signed_in?
|
||||
|
|
|
@ -1 +1 @@
|
|||
= link_to 'Aide', FAQ_URL, class: 'button primary'
|
||||
= link_to t('help'), FAQ_URL, class: 'button primary'
|
||||
|
|
|
@ -3,27 +3,27 @@
|
|||
.auth-form
|
||||
= devise_error_messages!
|
||||
= form_for resource, url: user_registration_path, html: { class: "form" } do |f|
|
||||
%h1 Créez-vous un compte #{APPLICATION_NAME}
|
||||
%h1= t('views.registrations.new.title', name: APPLICATION_NAME)
|
||||
|
||||
= render partial: 'shared/france_connect_login', locals: { url: france_connect_particulier_path }
|
||||
|
||||
= f.label :email, "Email (nom@site.com)", id: :user_email_label
|
||||
= f.text_field :email, type: :email, autocomplete: 'email', autofocus: true, placeholder: "Votre adresse email", 'aria-describedby': :user_email_label
|
||||
= f.label :email, t('views.registrations.new.email_label'), id: :user_email_label
|
||||
= f.text_field :email, type: :email, autocomplete: 'email', autofocus: true, placeholder: t('views.registrations.new.email_placeholder'), 'aria-describedby': :user_email_label
|
||||
|
||||
.suspect-email.hidden
|
||||
.email-suggestion-title
|
||||
Voulez-vous dire
|
||||
= t('views.registrations.new.wanna_say')
|
||||
%span.email-suggestion-address blabla@gmail.com
|
||||
?
|
||||
.email-suggestion-answer
|
||||
= button_tag type: 'button', class: 'button small', onclick: "DS.acceptEmailSuggestion()" do
|
||||
Oui
|
||||
= t('simple_form.yes')
|
||||
= button_tag type: 'button', class: 'button small', onclick: "DS.discardEmailSuggestionBox()" do
|
||||
Non
|
||||
= t('simple_form.no')
|
||||
|
||||
= f.label :password, "Mot de passe (#{PASSWORD_MIN_LENGTH} caractères minimum)", id: :user_password_label
|
||||
= f.password_field :password, autocomplete: 'new-password', value: @user.password, placeholder: "#{PASSWORD_MIN_LENGTH} caractères minimum", 'aria-describedby': :user_password_label
|
||||
= f.label :password, t('views.registrations.new.password_label', min_length: PASSWORD_MIN_LENGTH), id: :user_password_label
|
||||
= f.password_field :password, autocomplete: 'new-password', value: @user.password, placeholder: t('views.registrations.new.password_placeholder', min_length: PASSWORD_MIN_LENGTH), 'aria-describedby': :user_password_label
|
||||
|
||||
= f.submit "Créer un compte", class: "button large primary expand"
|
||||
= f.submit t('views.shared.account.create'), class: "button large primary expand"
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
# available at http://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
en:
|
||||
help: 'Help'
|
||||
utils:
|
||||
deconnexion: "Log out"
|
||||
pj: "Attachments"
|
||||
|
@ -51,6 +52,23 @@ en:
|
|||
existing_dossiers: You already have files for this procedure
|
||||
show_dossiers: View my current files
|
||||
start_new_dossier: Start a new file
|
||||
already_draft: "You already started to fill a file"
|
||||
already_draft_detail_html: "You started to fill a file for the \"%{procedure}\" procedure <strong>%{time_ago} ago</strong>"
|
||||
already_not_draft: "You already submitted a file"
|
||||
already_not_draft_detail_html: "You submitted a file for the \"%{procedure}\" procedure <strong>%{time_ago} ago</strong>."
|
||||
continue_file: "Continue to fill my file"
|
||||
start_new_file: "Start a new file"
|
||||
show_my_submitted_file: 'Show my submitted file'
|
||||
want_empty_pdf: "You prefer to submit a paper form? You can download an empty PDF file, and send it to the right administration : %{service} - %{adresse}"
|
||||
download_empty_pdf: 'Download an empty PDF file'
|
||||
registrations:
|
||||
new:
|
||||
title: "Create an account %{name}"
|
||||
email_label: 'Email (name@site.com)'
|
||||
email_placeholder: 'Your email address'
|
||||
wanna_say: 'Do you mean to say'
|
||||
password_label: "Password (%{min_length} characters minimum)"
|
||||
password_placeholder: "%{min_length} characters minimum"
|
||||
invites:
|
||||
dropdown:
|
||||
invite_to_edit: Invite someone to edit this file
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
# available at http://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
fr:
|
||||
help: 'Aide'
|
||||
utils:
|
||||
deconnexion: "Déconnexion"
|
||||
pj: "Pièces jointes"
|
||||
|
@ -40,7 +41,25 @@ fr:
|
|||
start_procedure: Commencer la démarche
|
||||
existing_dossiers: Vous avez déjà des dossiers pour cette démarche
|
||||
show_dossiers: Voir mes dossiers en cours
|
||||
start_new_dossier: Commencer un nouveau dossier
|
||||
already_draft: "Vous avez déjà commencé à remplir un dossier"
|
||||
already_draft_detail_html: "Il y a <strong>%{time_ago}</strong>, vous avez commencé à remplir un dossier sur la démarche « %{procedure} »."
|
||||
already_not_draft: "Vous avez déjà déposé un dossier"
|
||||
already_not_draft_detail_html: "Il y a <strong>%{time_ago}</strong>, vous avez déposé un dossier sur la démarche « %{procedure} »."
|
||||
continue_file: 'Continuer à remplir mon dossier'
|
||||
start_new_file: 'Commencer un nouveau dossier'
|
||||
show_my_submitted_file: 'Voir mon dossier déposé'
|
||||
want_empty_pdf: "Vous souhaitez effectuer une demande par papier ? Vous pouvez télécharger un dossier vide au format PDF, et l'envoyer à l’administration concernée : %{service} - %{adresse}"
|
||||
download_empty_pdf: 'Télécharger un dossier vide au format PDF'
|
||||
registrations:
|
||||
new:
|
||||
title: "Créez-vous un compte %{name}"
|
||||
email_label: 'Email (nom@site.com)'
|
||||
email_placeholder: 'Votre adresse email'
|
||||
wanna_say: 'Voulez-vous dire'
|
||||
password_label: "Mot de passe (%{min_length} caractères minimum)"
|
||||
password_placeholder: "%{min_length} caractères minimum"
|
||||
|
||||
|
||||
invites:
|
||||
dropdown:
|
||||
invite_to_edit: Inviter une personne à modifier ce dossier
|
||||
|
|
|
@ -5,5 +5,10 @@ en:
|
|||
title: "With FranceConnect"
|
||||
description: "France connect is a solution proposed by the government to secure and simplify the connection to web services."
|
||||
login_button: "Sign in with FranceConnect"
|
||||
help_link: What is FranceConnect ?
|
||||
separator: or
|
||||
help_link: What is FranceConnect?
|
||||
separator: or
|
||||
account:
|
||||
already_user_question: 'Do you already have an account?'
|
||||
already_user: "I already have an account"
|
||||
create: 'Create an account'
|
||||
signin: 'Sign in'
|
||||
|
|
|
@ -15,3 +15,8 @@ fr:
|
|||
login_button: "S’identifier avec FranceConnect"
|
||||
help_link: "Qu’est-ce que FranceConnect ?"
|
||||
separator: 'ou'
|
||||
account:
|
||||
already_user_question: 'Vous avez déjà un compte ?'
|
||||
already_user: 'J’ai déjà un compte'
|
||||
create: 'Créer un compte'
|
||||
signin: 'Connexion'
|
||||
|
|
Loading…
Reference in a new issue