mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
VKAPI: Add support for attachments for comments
This commit is contained in:
parent
43e18a9173
commit
06b77ebad8
1 changed files with 23 additions and 0 deletions
|
@ -559,6 +559,14 @@ final class Wall extends VKAPIRequestHandler
|
||||||
$oid = $owner->getId();
|
$oid = $owner->getId();
|
||||||
if($owner instanceof Club)
|
if($owner instanceof Club)
|
||||||
$oid *= -1;
|
$oid *= -1;
|
||||||
|
|
||||||
|
$attachments = [];
|
||||||
|
|
||||||
|
foreach($comment->getChildren() as $attachment) {
|
||||||
|
if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
|
||||||
|
$attachments[] = $this->getApiPhoto($attachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$item = [
|
$item = [
|
||||||
"id" => $comment->getId(),
|
"id" => $comment->getId(),
|
||||||
|
@ -568,6 +576,7 @@ final class Wall extends VKAPIRequestHandler
|
||||||
"post_id" => $post->getVirtualId(),
|
"post_id" => $post->getVirtualId(),
|
||||||
"owner_id" => $post->isPostedOnBehalfOfGroup() ? $post->getOwner()->getId() * -1 : $post->getOwner()->getId(),
|
"owner_id" => $post->isPostedOnBehalfOfGroup() ? $post->getOwner()->getId() * -1 : $post->getOwner()->getId(),
|
||||||
"parents_stack" => [],
|
"parents_stack" => [],
|
||||||
|
"attachments" => $attachments,
|
||||||
"thread" => [
|
"thread" => [
|
||||||
"count" => 0,
|
"count" => 0,
|
||||||
"items" => [],
|
"items" => [],
|
||||||
|
@ -588,6 +597,9 @@ final class Wall extends VKAPIRequestHandler
|
||||||
$items[] = $item;
|
$items[] = $item;
|
||||||
if($extended == true)
|
if($extended == true)
|
||||||
$profiles[] = $comment->getOwner()->getId();
|
$profiles[] = $comment->getOwner()->getId();
|
||||||
|
|
||||||
|
$attachments = null;
|
||||||
|
// Reset $attachments to not duplicate prikols
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
|
@ -614,6 +626,14 @@ final class Wall extends VKAPIRequestHandler
|
||||||
|
|
||||||
$profiles = [];
|
$profiles = [];
|
||||||
|
|
||||||
|
$attachments = [];
|
||||||
|
|
||||||
|
foreach($comment->getChildren() as $attachment) {
|
||||||
|
if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
|
||||||
|
$attachments[] = $this->getApiPhoto($attachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$item = [
|
$item = [
|
||||||
"id" => $comment->getId(),
|
"id" => $comment->getId(),
|
||||||
"from_id" => $comment->getOwner()->getId(),
|
"from_id" => $comment->getOwner()->getId(),
|
||||||
|
@ -622,6 +642,7 @@ final class Wall extends VKAPIRequestHandler
|
||||||
"post_id" => $comment->getTarget()->getVirtualId(),
|
"post_id" => $comment->getTarget()->getVirtualId(),
|
||||||
"owner_id" => $comment->getTarget()->isPostedOnBehalfOfGroup() ? $comment->getTarget()->getOwner()->getId() * -1 : $comment->getTarget()->getOwner()->getId(),
|
"owner_id" => $comment->getTarget()->isPostedOnBehalfOfGroup() ? $comment->getTarget()->getOwner()->getId() * -1 : $comment->getTarget()->getOwner()->getId(),
|
||||||
"parents_stack" => [],
|
"parents_stack" => [],
|
||||||
|
"attachments" => $attachments,
|
||||||
"likes" => [
|
"likes" => [
|
||||||
"can_like" => 1,
|
"can_like" => 1,
|
||||||
"count" => $comment->getLikesCount(),
|
"count" => $comment->getLikesCount(),
|
||||||
|
@ -652,6 +673,8 @@ final class Wall extends VKAPIRequestHandler
|
||||||
$response['profiles'] = (!empty($profiles) ? (new Users)->get(implode(',', $profiles), $fields) : []);
|
$response['profiles'] = (!empty($profiles) ? (new Users)->get(implode(',', $profiles), $fields) : []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue