aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2020-04-04 22:08:08 +0200
committerKevin Decherf <kevin@kdecherf.com>2020-04-18 18:09:07 +0200
commita19caf8a37dfd59a4e270507ec08e9fc259e3e1e (patch)
tree641630f6a7f560a6fb959a58be1d5094f283d0ef /src/Wallabag
parent39133eb796996701228501f898b4ef33af8e0fdb (diff)
downloadwallabag-a19caf8a37dfd59a4e270507ec08e9fc259e3e1e.tar.gz
wallabag-a19caf8a37dfd59a4e270507ec08e9fc259e3e1e.tar.zst
wallabag-a19caf8a37dfd59a4e270507ec08e9fc259e3e1e.zip
TagController: prevent tag deletion when renaming a tag with the same label
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index c228c27a..f7b78f5d 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -151,7 +151,10 @@ class TagController extends Controller
151 $form = $this->createForm(RenameTagType::class, new Tag()); 151 $form = $this->createForm(RenameTagType::class, new Tag());
152 $form->handleRequest($request); 152 $form->handleRequest($request);
153 153
154 if ($form->isSubmitted() && $form->isValid()) { 154 if ($form->isSubmitted()
155 && $form->isValid()
156 && $form->get('label')->getData() !== $tag->getLabel()
157 ) {
155 $newTagLabel = $form->get('label')->getData(); 158 $newTagLabel = $form->get('label')->getData();
156 $newTag = new Tag(); 159 $newTag = new Tag();
157 $newTag->setLabel($newTagLabel); 160 $newTag->setLabel($newTagLabel);
@@ -171,12 +174,12 @@ class TagController extends Controller
171 174
172 $em = $this->getDoctrine()->getManager(); 175 $em = $this->getDoctrine()->getManager();
173 $em->flush(); 176 $em->flush();
174 }
175 177
176 $this->get('session')->getFlashBag()->add( 178 $this->get('session')->getFlashBag()->add(
177 'notice', 179 'notice',
178 'flashes.tag.notice.tag_renamed' 180 'flashes.tag.notice.tag_renamed'
179 ); 181 );
182 }
180 183
181 $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true); 184 $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true);
182 185