From d3708cf1c2c819bb3a1711884cbd1b7328fcc4ac Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 11 Nov 2020 22:59:57 -0500 Subject: [PATCH] Fix wrong variable use in Model\Item::getTopLevelParent - It was preventing items at levels 3 and beyond to be inserted - Logging for missing top level parent has been bumped to notice --- src/Model/Item.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index a8ac82ede..1ccd85c64 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1496,7 +1496,7 @@ class Item $parent = self::selectFirst($fields, $condition, $params); if (!DBA::isResult($parent)) { - Logger::info('item parent was not found - ignoring item', ['thr-parent' => $item['thr-parent'], 'uid' => $item['uid']]); + Logger::notice('item parent was not found - ignoring item', ['thr-parent' => $item['thr-parent'], 'uid' => $item['uid']]); return []; } @@ -1504,21 +1504,21 @@ class Item return $parent; } - $condition = ['uri' => $item['parent-uri'], - 'parent-uri' => $item['parent-uri'], - 'uid' => $item['uid']]; + $condition = ['uri' => $parent['parent-uri'], + 'parent-uri' => $parent['parent-uri'], + 'uid' => $parent['uid']]; // We select wall = 1 in priority for top level permission checks $params = ['order' => ['wall' => true]]; $toplevel_parent = self::selectFirst($fields, $condition, $params); if (!DBA::isResult($toplevel_parent)) { - Logger::info('item parent was not found - ignoring item', ['parent-uri' => $item['parent-uri'], 'uid' => $item['uid']]); + Logger::notice('item top level parent was not found - ignoring item', ['parent-uri' => $parent['parent-uri'], 'uid' => $parent['uid']]); return []; } if ($toplevel_parent['wall'] - && $toplevel_parent['uid'] && - !self::isAllowedByUser($item, $toplevel_parent['uid']) + && $toplevel_parent['uid'] + && !self::isAllowedByUser($item, $toplevel_parent['uid']) ) { return []; }