]> git.mxchange.org Git - friendica.git/blobdiff - mod/notes.php
Merge pull request #5967 from annando/ap-nick
[friendica.git] / mod / notes.php
index 608d01cf8c63fbf1ed718788ab0eba5f5ffd3db6..55a92f8e64f674fc34716f0d656d174f238f7ea1 100644 (file)
@@ -33,7 +33,6 @@ function notes_content(App $a, $update = false)
                return;
        }
 
-       require_once 'include/security.php';
        require_once 'include/conversation.php';
 
        $o = Profile::getTabs($a, true);
@@ -61,30 +60,20 @@ function notes_content(App $a, $update = false)
        $condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
                'wall' => false, 'contact-id'=> $a->contact['id']];
 
-       $a->set_pager_itemspage(40);
+       $a->setPagerItemsPage(40);
 
        $params = ['order' => ['created' => true],
                'limit' => [$a->pager['start'], $a->pager['itemspage']]];
-       $r = Item::selectForUser(local_user(), ['id'], $condition, $params);
+       $r = Item::selectThreadForUser(local_user(), ['uri'], $condition, $params);
 
        $count = 0;
 
        if (DBA::isResult($r)) {
-               $count = count($r);
-               $parents_arr = [];
+               $notes = DBA::toArray($r);
 
-               while ($rr = Item::fetch($r)) {
-                       $parents_arr[] = $rr['id'];
-               }
-               DBA::close($r);
+               $count = count($notes);
 
-               $condition = ['uid' => local_user(), 'parent' => $parents_arr];
-               $result = Item::selectForUser(local_user(), [], $condition);
-
-               if (DBA::isResult($result)) {
-                       $items = conv_sort(Item::inArray($result), 'commented');
-                       $o .= conversation($a, $items, 'notes', $update);
-               }
+               $o .= conversation($a, $notes, 'notes', $update);
        }
 
        $o .= alt_pager($a, $count);