X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnotes.php;h=da8352966e721e3f2c7698dc51668efa33db5967;hb=db0b848ae30983b394847a5597c3f7c7332cfe7c;hp=af7bd71793bc854b656c17f020df7e39198c6b7b;hpb=daa1177e3a1e42b4c95e0a8759f1610942b952c7;p=friendica.git diff --git a/mod/notes.php b/mod/notes.php index af7bd71793..da8352966e 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -6,8 +6,7 @@ use Friendica\App; use Friendica\Content\Nav; use Friendica\Core\L10n; -use Friendica\Database\dba; -use Friendica\Database\DBM; +use Friendica\Database\DBA; 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; }