Fixed "tag already exists" when only changing case

This commit is contained in:
Marcin Kurczewski 2013-11-21 20:47:07 +01:00
parent a98c61ebf3
commit cab63895c2

View file

@ -91,14 +91,15 @@ class TagController
{
$suppliedSourceTag = InputHelper::get('source-tag');
$suppliedSourceTag = Model_Tag::validateTag($suppliedSourceTag);
$sourceTag = Model_Tag::locate($suppliedSourceTag);
$suppliedTargetTag = InputHelper::get('target-tag');
$suppliedTargetTag = Model_Tag::validateTag($suppliedTargetTag);
$targetTag = Model_Tag::locate($suppliedTargetTag, false);
if ($targetTag)
if ($targetTag and $targetTag->id != $sourceTag->id)
throw new SimpleException('Target tag already exists');
$sourceTag = Model_Tag::locate($suppliedSourceTag);
$sourceTag->name = $suppliedTargetTag;
R::store($sourceTag);