VKAPI: Fix newsfeed

This commit is contained in:
veselcraft 2022-10-12 12:23:57 +03:00
parent dffa6d799e
commit 51d9aba5a6
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E

View file

@ -45,7 +45,7 @@ final class Wall extends VKAPIRequestHandler
$attachments[] = $this->getApiPhoto($attachment); $attachments[] = $this->getApiPhoto($attachment);
} else if($attachment instanceof \openvk\Web\Models\Entities\Poll) { } 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) { } else if ($attachment instanceof \openvk\Web\Models\Entities\Post) {
$repostAttachments = []; $repostAttachments = [];
@ -188,7 +188,7 @@ final class Wall extends VKAPIRequestHandler
if($attachment instanceof \openvk\Web\Models\Entities\Photo) { if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
$attachments[] = $this->getApiPhoto($attachment); $attachments[] = $this->getApiPhoto($attachment);
} else if($attachment instanceof \openvk\Web\Models\Entities\Poll) { } 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) { } else if ($attachment instanceof \openvk\Web\Models\Entities\Post) {
$repostAttachments = []; $repostAttachments = [];
@ -588,7 +588,7 @@ final class Wall extends VKAPIRequestHandler
]; ];
} }
private function getApiPoll($attachment) { private function getApiPoll($attachment, $user) {
$answers = array(); $answers = array();
foreach($attachment->getResults()->options as $answer) { foreach($attachment->getResults()->options as $answer) {
$answers[] = (object)[ $answers[] = (object)[
@ -600,7 +600,7 @@ final class Wall extends VKAPIRequestHandler
} }
$userVote = array(); $userVote = array();
foreach($attachment->getUserVote($this->getUser()) as $vote) foreach($attachment->getUserVote($user) as $vote)
$userVote[] = $vote[0]; $userVote[] = $vote[0];
return [ return [