revoke superadmin dossier transfer
This commit is contained in:
parent
7cfe0ad2a8
commit
122a6b6f5b
4 changed files with 26 additions and 0 deletions
|
@ -31,6 +31,12 @@ module Manager
|
|||
redirect_to manager_dossier_path(params[:id])
|
||||
end
|
||||
|
||||
def transfer_destroy
|
||||
dossier = Dossier.find(params[:id])
|
||||
dossier.transfer.destroy_and_nullify
|
||||
redirect_to manager_dossier_path(dossier), notice: t("users.dossiers.transferer.destroy")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def unfiltered_list?
|
||||
|
|
|
@ -36,6 +36,15 @@ as well as a link to its edit page.
|
|||
</header>
|
||||
|
||||
<section class="main-content__body">
|
||||
<div>
|
||||
<% if dossier.transfer&.from_support %>
|
||||
<p>
|
||||
<%= t('views.users.dossiers.transfers.sender_demande_en_cours_from_support', id: dossier.id, email: dossier.transfer.email) %>
|
||||
<br>
|
||||
<%= link_to t('views.users.dossiers.transfers.revoke'), transfer_destroy_manager_dossier_path(dossier), class: 'fr-link', method: :delete %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<dl>
|
||||
<% page.attributes.each do |attribute| %>
|
||||
<dt class="attribute-label" id="<%= attribute.name %>">
|
||||
|
|
|
@ -72,6 +72,7 @@ Rails.application.routes.draw do
|
|||
resources :dossiers, only: [:show] do
|
||||
get 'transfer_edit', on: :member
|
||||
post 'transfer', on: :member
|
||||
delete 'transfer_destroy', on: :member
|
||||
end
|
||||
|
||||
resources :bill_signatures, only: [:index]
|
||||
|
|
|
@ -55,4 +55,14 @@ describe Manager::DossiersController, type: :controller do
|
|||
it { expect(DossierMailer).not_to have_received(:notify_transfer) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE #transfer_destroy" do
|
||||
before do
|
||||
DossierTransfer.create(email: 'coucou@laposte.net', dossiers: [@dossier])
|
||||
delete :transfer_destroy, params: { id: @dossier.id }
|
||||
end
|
||||
|
||||
it { expect(@dossier.transfer).to be_nil }
|
||||
it { expect(flash[:notice]).to eq "La demande de transfert a été supprimée avec succès" }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue