mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-27 17:28:39 +00:00
TagController: prevent tag deletion when renaming a tag with the same label
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
parent
39133eb796
commit
a19caf8a37
2 changed files with 67 additions and 6 deletions
|
@ -151,7 +151,10 @@ class TagController extends Controller
|
|||
$form = $this->createForm(RenameTagType::class, new Tag());
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
if ($form->isSubmitted()
|
||||
&& $form->isValid()
|
||||
&& $form->get('label')->getData() !== $tag->getLabel()
|
||||
) {
|
||||
$newTagLabel = $form->get('label')->getData();
|
||||
$newTag = new Tag();
|
||||
$newTag->setLabel($newTagLabel);
|
||||
|
@ -171,12 +174,12 @@ class TagController extends Controller
|
|||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
'notice',
|
||||
'flashes.tag.notice.tag_renamed'
|
||||
);
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
'notice',
|
||||
'flashes.tag.notice.tag_renamed'
|
||||
);
|
||||
}
|
||||
|
||||
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue