mirror of
https://github.com/openvk/openvk
synced 2025-03-04 08:39:50 +03:00
fix(VKAPI/Handlers/Notes): move $nodez declaration up
This commit is contained in:
parent
a1f5fcbe88
commit
f672e5001a
1 changed files with 7 additions and 4 deletions
|
@ -185,12 +185,14 @@ final class Notes extends VKAPIRequestHandler
|
||||||
$this->fail(15, "Access denied");
|
$this->fail(15, "Access denied");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($note_ids)) {
|
|
||||||
$notes = array_slice(iterator_to_array((new NotesRepo())->getUserNotes($user, 1, $count + $offset, $sort == 0 ? "ASC" : "DESC")), $offset);
|
|
||||||
$nodez = (object) [
|
$nodez = (object) [
|
||||||
"count" => (new NotesRepo())->getUserNotesCount((new UsersRepo())->get($user_id)),
|
"count" => 0,
|
||||||
"notes" => [],
|
"notes" => [],
|
||||||
];
|
];
|
||||||
|
if (empty($note_ids)) {
|
||||||
|
$nodez->count = (new NotesRepo())->getUserNotesCount($user);
|
||||||
|
|
||||||
|
$notes = array_slice(iterator_to_array((new NotesRepo())->getUserNotes($user, 1, $count + $offset, $sort == 0 ? "ASC" : "DESC")), $offset);
|
||||||
|
|
||||||
foreach ($notes as $note) {
|
foreach ($notes as $note) {
|
||||||
if ($note->isDeleted()) {
|
if ($note->isDeleted()) {
|
||||||
|
@ -210,6 +212,7 @@ final class Notes extends VKAPIRequestHandler
|
||||||
$note = (new NotesRepo())->getNoteById((int) $id[0], (int) $id[1]);
|
$note = (new NotesRepo())->getNoteById((int) $id[0], (int) $id[1]);
|
||||||
if ($note && !$note->isDeleted()) {
|
if ($note && !$note->isDeleted()) {
|
||||||
$nodez->notes[] = $note->toVkApiStruct();
|
$nodez->notes[] = $note->toVkApiStruct();
|
||||||
|
$nodez->count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue