X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnotes.php;h=da8352966e721e3f2c7698dc51668efa33db5967;hb=bedab33e0b3a1636332c8f07c157a357bf3fd459;hp=f83195ff1ccdb1e1a16f75375d8df20bd1b27ad9;hpb=af6dbc654f82225cfc647fe2072662acae388e47;p=friendica.git diff --git a/mod/notes.php b/mod/notes.php index f83195ff1c..da8352966e 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -7,7 +7,6 @@ use Friendica\App; use Friendica\Content\Nav; use Friendica\Core\L10n; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Item; use Friendica\Model\Profile; @@ -60,30 +59,25 @@ function notes_content(App $a, $update = false) } $condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT, - 'wall' => false, 'allow_cid' => '<' . $a->contact['id'] . '>', 'contact-id'=> $a->contact['id']]; + '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); - - if (DBM::is_result($r)) { - $parents_arr = []; - - while ($rr = Item::fetch($r)) { - $parents_arr[] = $rr['id']; - } - DBA::close($r); - - $condition = ['uid' => local_user(), 'parent' => $parents_arr]; - $result = Item::selectForUser(local_user(), [], $condition); - if (DBM::is_result($result)) { - $items = conv_sort(Item::inArray($result), 'commented'); - $o .= conversation($a, $items, 'notes', $update); - } + $r = Item::selectThreadForUser(local_user(), ['uri'], $condition, $params); + + $count = 0; + + if (DBA::isResult($r)) { + $notes = DBA::toArray($r); + + $count = count($notes); + + $o .= conversation($a, $notes, 'notes', $update); } - $o .= alt_pager($a, count($r)); + $o .= alt_pager($a, $count); + return $o; }