From f8493a1df26f242959e931d862c5f1282dd324e8 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Apr 2011 08:57:09 -0700 Subject: Revert my two "fixes" on top of Andy's tag combine change. Leave Tag_Model::items() calling Item_Model::viewable() because it's too dangerous to separate that out, and it's fragile to rely on only admins doing tag combines. Revert "Undo the change made in 5ce85636329b14673718836b3631a3e46efdc3bb because it messes up tag counts" - This reverts commit 67d2e8081c6e5f0b679881bca3fdc81fe1e78ccc. Revert "Move the calculation for item_related_update ahead of the duplicate" - This reverts commit 5ce85636329b14673718836b3631a3e46efdc3bb. --- modules/tag/models/tag.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php index 13e253ba..bb79e707 100644 --- a/modules/tag/models/tag.php +++ b/modules/tag/models/tag.php @@ -75,8 +75,12 @@ class Tag_Model_Core extends ORM { ->where("id", "!=", $this->id) ->find(); if ($duplicate_tag->loaded()) { - // If so, tag its items with this tag so as to merge it. - foreach ($duplicate_tag->items() as $item) { + // If so, tag its items with this tag so as to merge it + $duplicate_tag_items = ORM::factory("item") + ->join("items_tags", "items.id", "items_tags.item_id") + ->where("items_tags.tag_id", "=", $duplicate_tag->id) + ->find_all(); + foreach ($duplicate_tag_items as $item) { $this->add($item); } @@ -84,7 +88,6 @@ class Tag_Model_Core extends ORM { $duplicate_tag->delete(); } - // Figure out what items have changed in this tag for our item_related_update event below if (isset($this->object_relations["items"])) { $added = array_diff($this->changed_relations["items"], $this->object_relations["items"]); $removed = array_diff($this->object_relations["items"], $this->changed_relations["items"]); -- cgit v1.2.3 From ea2127c3b2ddef5709e02b4804c074bd1f942159 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Apr 2011 21:02:34 -0700 Subject: Fix a bug introduced in f2477703faa7cd05ff1aa16da3ecef7b666bef40 which was a fix for #1581 that caused us to skip adding highlights for any albums that had no sub-albums. --- modules/g2_import/helpers/g2_import.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 23fb29e5..e9c19c9d 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -518,12 +518,11 @@ class g2_import_Core { static function set_album_highlight(&$queue) { // Dequeue the current album and enqueue its children list($g2_album_id, $children) = each($queue); - if (empty($children)) { - return; - } unset($queue[$g2_album_id]); - foreach ($children as $key => $value) { - $queue[$key] = $value; + if (!empty($children)) { + foreach ($children as $key => $value) { + $queue[$key] = $value; + } } $messages = array(); -- cgit v1.2.3