refactor(avis): rename revive by remind
This commit is contained in:
parent
2475bb1098
commit
b306dea5cf
7 changed files with 12 additions and 12 deletions
|
@ -14,7 +14,7 @@ module Instructeurs
|
|||
end
|
||||
end
|
||||
|
||||
def revive
|
||||
def remind
|
||||
avis = Avis.find(params[:id])
|
||||
if avis.remind_by!(current_instructeur)
|
||||
AvisMailer.avis_invitation(avis).deliver_later
|
||||
|
|
|
@ -84,8 +84,8 @@ class Avis < ApplicationRecord
|
|||
revoked_at.present?
|
||||
end
|
||||
|
||||
def revivable_by?(reviver)
|
||||
revokable_by?(reviver)
|
||||
def remindable_by?(reminder)
|
||||
revokable_by?(reminder)
|
||||
end
|
||||
|
||||
def revokable_by?(revocator)
|
||||
|
@ -103,7 +103,7 @@ class Avis < ApplicationRecord
|
|||
end
|
||||
|
||||
def remind_by!(revocator)
|
||||
return false if !revivable_by?(revocator) || answer.present?
|
||||
update!(revived_at: Time.zone.now)
|
||||
return false if !remindable_by?(revocator) || answer.present?
|
||||
update!(reminded_at: Time.zone.now)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
%span.fr-text--xs.fr-text-mention--grey
|
||||
= t('en_attente', scope: 'views.shared.avis')
|
||||
|
|
||||
%span= link_to(t('revive', scope: 'helpers.label'), revive_instructeur_avis_path(avis.procedure, avis), data: { confirm: t('revive', scope: 'helpers.confirmation', email: avis.expert.email) })
|
||||
%span= link_to(t('remind', scope: 'helpers.label'), remind_instructeur_avis_path(avis.procedure, avis), data: { confirm: t('remind', scope: 'helpers.confirmation', email: avis.expert.email) })
|
||||
- if avis.revokable_by?(current_instructeur)
|
||||
|
|
||||
= link_to(t('revoke', scope: 'helpers.label'), revoquer_instructeur_avis_path(avis.procedure, avis), data: { confirm: t('revoke', scope: 'helpers.confirmation', email: avis.expert.email) }, method: :patch)
|
||||
|
|
|
@ -13,9 +13,9 @@ fr:
|
|||
one: Inviter aussi l’expert sur le dossier lié n° %{ids}
|
||||
other: Inviter aussi l’expert sur les dossiers liés n° %{ids}
|
||||
revoke: Révoquer la demande d’avis
|
||||
revive: Relancer l’expert
|
||||
remind: Relancer l’expert
|
||||
hint:
|
||||
confidentiel: "Cet avis n’est pas affiché avec les autres experts consultés"
|
||||
confirmation:
|
||||
revoke: "Souhaitez-vous révoquer la demande d’avis à %{email} ?"
|
||||
revive: "Souhaitez-vous relancer %{email} ?"
|
||||
remind: "Souhaitez-vous relancer %{email} ?"
|
||||
|
|
|
@ -7,7 +7,7 @@ en:
|
|||
avis:
|
||||
demande_envoyee_le: "Feedback send at %{date}"
|
||||
demande_revoquee_le: "Feedback revoked at %{date}"
|
||||
relance_effectuee_le: "Revival sent at %{date}"
|
||||
relance_effectuee_le: "Reminder sent at %{date}"
|
||||
reponse_donnee_le: "Response sent at %{date}"
|
||||
en_attente: "Waiting for response"
|
||||
france_connect_login:
|
||||
|
|
|
@ -393,7 +393,7 @@ Rails.application.routes.draw do
|
|||
get '', action: 'procedure', on: :collection, as: :procedure
|
||||
member do
|
||||
patch 'revoquer'
|
||||
get 'revive'
|
||||
get 'remind'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -24,13 +24,13 @@ describe Instructeurs::AvisController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'revive' do
|
||||
describe 'remind' do
|
||||
before do
|
||||
allow(AvisMailer).to receive(:avis_invitation).and_return(double(deliver_later: nil))
|
||||
end
|
||||
|
||||
it 'sends a reminder to the expert' do
|
||||
get :revive, params: { procedure_id: procedure.id, id: avis.id }
|
||||
get :remind, params: { procedure_id: procedure.id, id: avis.id }
|
||||
expect(AvisMailer).to have_received(:avis_invitation).once.with(avis)
|
||||
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
||||
expect(avis.reload.reminded_at).to be_present
|
||||
|
|
Loading…
Reference in a new issue