mirror of
https://github.com/openvk/openvk
synced 2024-11-13 10:39:24 +03:00
VKAPI: Fix 500 error if some peers_id is invalid
This commit is contained in:
parent
ca27e0588a
commit
c3610cdd4d
1 changed files with 28 additions and 26 deletions
|
@ -247,32 +247,34 @@ final class Messages extends VKAPIRequestHandler
|
||||||
|
|
||||||
$user = (new USRRepo)->get((int) $peer);
|
$user = (new USRRepo)->get((int) $peer);
|
||||||
|
|
||||||
$dialogue = new Correspondence($this->getUser(), $user);
|
if($user) {
|
||||||
$iterator = $dialogue->getMessages(Correspondence::CAP_BEHAVIOUR_START_MESSAGE_ID, 0, 1, 0, false);
|
$dialogue = new Correspondence($this->getUser(), $user);
|
||||||
$msg = $iterator[0]->unwrap(); // шоб удобнее было
|
$iterator = $dialogue->getMessages(Correspondence::CAP_BEHAVIOUR_START_MESSAGE_ID, 0, 1, 0, false);
|
||||||
$output['items'][] = [
|
$msg = $iterator[0]->unwrap(); // шоб удобнее было
|
||||||
"peer" => [
|
$output['items'][] = [
|
||||||
"id" => $user->getId(),
|
"peer" => [
|
||||||
"type" => "user",
|
"id" => $user->getId(),
|
||||||
"local_id" => $user->getId()
|
"type" => "user",
|
||||||
],
|
"local_id" => $user->getId()
|
||||||
"last_message_id" => $msg->id,
|
],
|
||||||
"in_read" => $msg->id,
|
"last_message_id" => $msg->id,
|
||||||
"out_read" => $msg->id,
|
"in_read" => $msg->id,
|
||||||
"sort_id" => [
|
"out_read" => $msg->id,
|
||||||
"major_id" => 0,
|
"sort_id" => [
|
||||||
"minor_id" => $msg->id, // КОНЕЧНО ЖЕ
|
"major_id" => 0,
|
||||||
],
|
"minor_id" => $msg->id, // КОНЕЧНО ЖЕ
|
||||||
"last_conversation_message_id" => $user->getId(),
|
],
|
||||||
"in_read_cmid" => $user->getId(),
|
"last_conversation_message_id" => $user->getId(),
|
||||||
"out_read_cmid" => $user->getId(),
|
"in_read_cmid" => $user->getId(),
|
||||||
"is_marked_unread" => $iterator[0]->isUnread(),
|
"out_read_cmid" => $user->getId(),
|
||||||
"important" => false, // целестора когда релиз
|
"is_marked_unread" => $iterator[0]->isUnread(),
|
||||||
"can_write" => [
|
"important" => false, // целестора когда релиз
|
||||||
"allowed" => ($user->getId() === $this->getUser()->getId() || $user->getPrivacyPermission('messages.write', $this->getUser()) === true)
|
"can_write" => [
|
||||||
]
|
"allowed" => ($user->getId() === $this->getUser()->getId() || $user->getPrivacyPermission('messages.write', $this->getUser()) === true)
|
||||||
];
|
]
|
||||||
$userslist[] = $user->getId();
|
];
|
||||||
|
$userslist[] = $user->getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($extended == 1) {
|
if($extended == 1) {
|
||||||
|
|
Loading…
Reference in a new issue