From 51d9aba5a6fff615f78540931d5e70be3c0aa757 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Wed, 12 Oct 2022 12:23:57 +0300 Subject: [PATCH] VKAPI: Fix newsfeed --- VKAPI/Handlers/Wall.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/VKAPI/Handlers/Wall.php b/VKAPI/Handlers/Wall.php index 1e4024f4..25b168ac 100644 --- a/VKAPI/Handlers/Wall.php +++ b/VKAPI/Handlers/Wall.php @@ -45,7 +45,7 @@ final class Wall extends VKAPIRequestHandler $attachments[] = $this->getApiPhoto($attachment); } else if($attachment instanceof \openvk\Web\Models\Entities\Poll) { - $attachments[] = $this->getApiPoll($attachment); + $attachments[] = $this->getApiPoll($attachment, $this->getUser()); } else if ($attachment instanceof \openvk\Web\Models\Entities\Post) { $repostAttachments = []; @@ -188,7 +188,7 @@ final class Wall extends VKAPIRequestHandler if($attachment instanceof \openvk\Web\Models\Entities\Photo) { $attachments[] = $this->getApiPhoto($attachment); } else if($attachment instanceof \openvk\Web\Models\Entities\Poll) { - $attachments[] = $this->getApiPoll($attachment); + $attachments[] = $this->getApiPoll($attachment, $user); } else if ($attachment instanceof \openvk\Web\Models\Entities\Post) { $repostAttachments = []; @@ -588,7 +588,7 @@ final class Wall extends VKAPIRequestHandler ]; } - private function getApiPoll($attachment) { + private function getApiPoll($attachment, $user) { $answers = array(); foreach($attachment->getResults()->options as $answer) { $answers[] = (object)[ @@ -600,7 +600,7 @@ final class Wall extends VKAPIRequestHandler } $userVote = array(); - foreach($attachment->getUserVote($this->getUser()) as $vote) + foreach($attachment->getUserVote($user) as $vote) $userVote[] = $vote[0]; return [