]> git.mxchange.org Git - friendica.git/commitdiff
Fix wrong variable use in Model\Item::getTopLevelParent
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 12 Nov 2020 03:59:57 +0000 (22:59 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 14 Nov 2020 15:08:51 +0000 (10:08 -0500)
- 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

index a8ac82edec16258426bfbc12f48e98ab356b5344..1ccd85c64c670000920e776dc505f27d4da4b812 100644 (file)
@@ -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 [];
                }