mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
TagController: fix duplicated tags when renaming them
The fix relies on a workaround available on TagsAssigner, see the AssignTagsToEntry() signature for detail. I replaced the findOneByLabel in the corresponding test to assert that there is no duplicate. Fixes #4216 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
parent
f3565ea2bf
commit
39133eb796
2 changed files with 37 additions and 8 deletions
|
@ -152,6 +152,10 @@ class TagController extends Controller
|
|||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$newTagLabel = $form->get('label')->getData();
|
||||
$newTag = new Tag();
|
||||
$newTag->setLabel($newTagLabel);
|
||||
|
||||
$entries = $this->get('wallabag_core.entry_repository')->findAllByTagId(
|
||||
$this->getUser()->getId(),
|
||||
$tag->getId()
|
||||
|
@ -159,7 +163,8 @@ class TagController extends Controller
|
|||
foreach ($entries as $entry) {
|
||||
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
|
||||
$entry,
|
||||
$form->get('label')->getData()
|
||||
$newTagLabel,
|
||||
[$newTag]
|
||||
);
|
||||
$entry->removeTag($tag);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue