From 47ab2464417efafbd929b39e1c75e3882d3312f9 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 15 Jun 2024 09:04:36 +0000 Subject: [PATCH] Fix paging on media pages --- src/Model/Contact.php | 19 ++++++++++--------- src/Module/Contact/Media.php | 2 +- src/Module/Profile/Media.php | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 490c61cf57..43d60257b5 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1547,24 +1547,25 @@ class Contact /** * Returns posts from a given contact url * - * @param string $contact_url Contact URL - * @param bool $thread_mode - * @param int $update Update mode - * @param int $parent Item parent ID for the update mode - * @param bool $only_media Only display media content + * @param string $contact_url Contact URL + * @param int $uid User ID + * @param bool $only_media Only display media content + * @param string $last_created Newest creation date, used for paging * @return string posts in HTML * @throws \Exception */ - public static function getPostsFromUrl(string $contact_url, int $uid, bool $only_media = false): string + public static function getPostsFromUrl(string $contact_url, int $uid, bool $only_media = false, string $last_created = null): string { - return self::getPostsFromId(self::getIdForURL($contact_url), $uid, $only_media); + return self::getPostsFromId(self::getIdForURL($contact_url), $uid, $only_media, $last_created); } /** * Returns posts from a given contact id * - * @param int $cid Contact ID - * @param bool $only_media Only display media content + * @param int $cid Contact ID + * @param int $uid User ID + * @param bool $only_media Only display media content + * @param string $last_created Newest creation date, used for paging * @return string posts in HTML * @throws \Exception */ diff --git a/src/Module/Contact/Media.php b/src/Module/Contact/Media.php index b8a8afa8e7..bb60887055 100644 --- a/src/Module/Contact/Media.php +++ b/src/Module/Contact/Media.php @@ -65,7 +65,7 @@ class Media extends BaseModule $o = Contact::getTabsHTML($contact, Contact::TAB_MEDIA); - $o .= ModelContact::getPostsFromUrl($contact['url'], $this->userSession->getLocalUserId(), true); + $o .= ModelContact::getPostsFromUrl($contact['url'], $this->userSession->getLocalUserId(), true, $request['last_created'] ?? ''); return $o; } diff --git a/src/Module/Profile/Media.php b/src/Module/Profile/Media.php index efb610caa3..64bb103322 100644 --- a/src/Module/Profile/Media.php +++ b/src/Module/Profile/Media.php @@ -64,7 +64,7 @@ class Media extends BaseProfile $o = self::getTabsHTML('media', $is_owner, $profile['nickname'], $profile['hide-friends']); - $o .= Contact::getPostsFromUrl($profile['url'], $this->userSession->getLocalUserId(), true); + $o .= Contact::getPostsFromUrl($profile['url'], $this->userSession->getLocalUserId(), true, $request['last_created'] ?? ''); return $o; }