1
0
mirror of https://github.com/Kovah/LinkAce.git synced 2025-01-29 19:07:48 +01:00

Hotfix for wrong redirects on link deletion (#346)

This commit is contained in:
Kovah 2022-01-08 10:06:20 +01:00
parent 9aff9e5fc4
commit 89f84c7340
No known key found for this signature in database
GPG Key ID: AAAA031BA9830D7B
5 changed files with 9 additions and 6 deletions

View File

@ -153,7 +153,8 @@ class LinkController extends Controller
}
flash(trans('link.deleted_successfully'), 'warning');
return redirect()->back();
return request()->has('redirect_back') ? redirect()->back() : redirect()->route('links.index');
}
/**

View File

@ -143,6 +143,6 @@ class ListController extends Controller
}
flash(trans('list.deleted_successfully'), 'warning');
return redirect()->back();
return request()->has('redirect_back') ? redirect()->back() : redirect()->route('lists.index');
}
}

View File

@ -76,7 +76,7 @@ class NoteController extends Controller
*/
public function destroy(Note $note): RedirectResponse
{
$linkId = $note->link->id;
$link = $note->link;
$deletionSuccessful = NoteRepository::delete($note);
@ -86,6 +86,6 @@ class NoteController extends Controller
}
flash(trans('note.deleted_successfully'), 'warning');
return redirect()->route('links.show', [$linkId]);
return redirect()->route('links.show', [$link]);
}
}

View File

@ -144,6 +144,7 @@ class TagController extends Controller
}
flash(trans('tag.deleted_successfully'), 'warning');
return redirect()->back();
return request()->has('redirect_back') ? redirect()->back() : redirect()->route('tags.index');
}
}

View File

@ -44,9 +44,10 @@
</a>
</div>
<form id="link-delete-{{ $link->id }}" method="POST" style="display: none;"
action="{{ route('links.destroy', [$link->id]) }}">
action="{{ route('links.destroy', [$link]) }}">
@method('DELETE')
@csrf
<input type="hidden" name="redirect_back" value="1">
<input type="hidden" name="link_id" value="{{ $link->id }}">
</form>
</td>