mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
VKAPI: Make getConversations output a real count of dialogs; Fix bug with extended param, when offset causes profile array to be dead xd
This commit is contained in:
parent
2fa36e123d
commit
4891030ed0
1 changed files with 6 additions and 5 deletions
|
@ -152,6 +152,7 @@ final class Messages extends VKAPIRequestHandler
|
|||
$this->requireUser();
|
||||
|
||||
$convos = (new MSGRepo)->getCorrespondencies($this->getUser(), -1, $count, $offset);
|
||||
$convosCount = (new MSGRepo)->getCorrespondenciesCount($this->getUser());
|
||||
$list = [];
|
||||
|
||||
$users = [];
|
||||
|
@ -197,7 +198,6 @@ final class Messages extends VKAPIRequestHandler
|
|||
$lastMessagePreview->emoji = true;
|
||||
|
||||
if($extended == 1) {
|
||||
$users[] = $lastMessage->getSender()->getId();
|
||||
$users[] = $author;
|
||||
}
|
||||
}
|
||||
|
@ -210,16 +210,17 @@ final class Messages extends VKAPIRequestHandler
|
|||
|
||||
if($extended == 0){
|
||||
return (object) [
|
||||
"count" => sizeof($list),
|
||||
"count" => $convosCount,
|
||||
"items" => $list,
|
||||
];
|
||||
} else {
|
||||
$users[] = $this->getUser()->getId();
|
||||
$users = array_unique($users);
|
||||
|
||||
return (object) [
|
||||
"count" => sizeof($list),
|
||||
"count" => $convosCount,
|
||||
"items" => $list,
|
||||
"profiles" => (!empty($users) ? (new APIUsers)->get(implode(',', $users), $fields, $offset, $count) : [])
|
||||
"profiles" => (!empty($users) ? (new APIUsers)->get(implode(',', $users), $fields, 0, $count+1) : [])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue