attachments: fix opening the delete link directly
When cliking on the "Delete attachment" link, and opening the URL in a new tab, the `DELETE /attachements/:id` will become `GET /attachments/:id` – which will cause the `show` action to be routed with an html format (instead of JS). In that case, we don't want to throw an error at the user face. Instead simply re-render the dossier page (if any). Fix a long-standing error in Sentry.
This commit is contained in:
parent
0077ff4b75
commit
b748e9773f
2 changed files with 11 additions and 0 deletions
|
@ -28,6 +28,12 @@ describe AttachmentsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when the user opens the delete link in a new tab' do
|
||||
let(:format) { :html }
|
||||
|
||||
it { is_expected.to have_http_status(302) }
|
||||
it { is_expected.to redirect_to(dossier_path(dossier)) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when not authenticated' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue