Added safety check for tag renaming

This commit is contained in:
Marcin Kurczewski 2013-11-01 20:44:01 +01:00
parent f7a0b7b440
commit 101864459d

View file

@ -81,6 +81,9 @@ class TagController
$suppliedTargetTag = InputHelper::get('target-tag');
$suppliedTargetTag = Model_Tag::validateTag($suppliedTargetTag);
$targetTag = Model_Tag::locate($suppliedTargetTag, false);
if ($targetTag)
throw new SimpleException('Target tag already exists');
$sourceTag = Model_Tag::locate($suppliedSourceTag);
$sourceTag->name = $suppliedTargetTag;