Return valid id for Comment in wall.getComments

Fixes #790, probably?
This commit is contained in:
celestora 2022-11-28 17:20:27 +02:00 committed by GitHub
parent a6ab5d38bb
commit b70710e164
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -441,9 +441,14 @@ final class Wall extends VKAPIRequestHandler
$profiles = []; $profiles = [];
foreach($comments as $comment) { foreach($comments as $comment) {
$owner = $comment->getOwner();
$oid = $owner->getId();
if($owner instanceof Club)
$oid *= -1;
$item = [ $item = [
"id" => $comment->getId(), "id" => $comment->getId(),
"from_id" => $comment->getOwner()->getId(), "from_id" => $oid,
"date" => $comment->getPublicationTime()->timestamp(), "date" => $comment->getPublicationTime()->timestamp(),
"text" => $comment->getText(false), "text" => $comment->getText(false),
"post_id" => $post->getVirtualId(), "post_id" => $post->getVirtualId(),