Fixed "tag already exists" when only changing case
This commit is contained in:
parent
a98c61ebf3
commit
cab63895c2
1 changed files with 3 additions and 2 deletions
|
@ -91,14 +91,15 @@ class TagController
|
||||||
{
|
{
|
||||||
$suppliedSourceTag = InputHelper::get('source-tag');
|
$suppliedSourceTag = InputHelper::get('source-tag');
|
||||||
$suppliedSourceTag = Model_Tag::validateTag($suppliedSourceTag);
|
$suppliedSourceTag = Model_Tag::validateTag($suppliedSourceTag);
|
||||||
|
$sourceTag = Model_Tag::locate($suppliedSourceTag);
|
||||||
|
|
||||||
$suppliedTargetTag = InputHelper::get('target-tag');
|
$suppliedTargetTag = InputHelper::get('target-tag');
|
||||||
$suppliedTargetTag = Model_Tag::validateTag($suppliedTargetTag);
|
$suppliedTargetTag = Model_Tag::validateTag($suppliedTargetTag);
|
||||||
$targetTag = Model_Tag::locate($suppliedTargetTag, false);
|
$targetTag = Model_Tag::locate($suppliedTargetTag, false);
|
||||||
if ($targetTag)
|
|
||||||
|
if ($targetTag and $targetTag->id != $sourceTag->id)
|
||||||
throw new SimpleException('Target tag already exists');
|
throw new SimpleException('Target tag already exists');
|
||||||
|
|
||||||
$sourceTag = Model_Tag::locate($suppliedSourceTag);
|
|
||||||
$sourceTag->name = $suppliedTargetTag;
|
$sourceTag->name = $suppliedTargetTag;
|
||||||
R::store($sourceTag);
|
R::store($sourceTag);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue