From c361ca0652de311402e8158830e0bef3f1db919e Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 31 Dec 2021 03:15:30 +0200 Subject: [PATCH] add feed by username support --- src/application/controller/api/post/get.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/application/controller/api/post/get.php b/src/application/controller/api/post/get.php index b2790e9..ff196aa 100644 --- a/src/application/controller/api/post/get.php +++ b/src/application/controller/api/post/get.php @@ -8,8 +8,9 @@ $response = [ if (isset($_SESSION['userName'])) { - if ($result = $_twister->getPosts($_twister->getFollowing($_SESSION['userName']), - APPLICATION_MAX_POST_FEED)) { + $userNames = isset($_POST['userName']) && Filter::userName($_POST['userName']) ? [$_POST['userName']] : $_twister->getFollowing($_SESSION['userName']); + + if ($result = $_twister->getPosts($userNames, APPLICATION_MAX_POST_FEED)) { $posts = []; foreach ($result as $post) {