Make notes soft-deletable

This commit is contained in:
Jill Stingray 2020-06-24 20:20:25 +00:00
parent 2fdc8a540c
commit a032ba09d2

View file

@ -29,12 +29,12 @@ class Notes
function getUserNotes(User $user, int $page = 1, ?int $perPage = NULL): \Traversable function getUserNotes(User $user, int $page = 1, ?int $perPage = NULL): \Traversable
{ {
$perPage = $perPage ?? OPENVK_DEFAULT_PER_PAGE; $perPage = $perPage ?? OPENVK_DEFAULT_PER_PAGE;
foreach($this->notes->where("owner", $user->getId())->page($page, $perPage) as $album) foreach($this->notes->where("owner", $user->getId())->where("deleted", 0)->page($page, $perPage) as $album)
yield new Note($album); yield new Note($album);
} }
function getUserNotesCount(User $user): int function getUserNotesCount(User $user): int
{ {
return sizeof($this->notes->where("owner", $user->getId())); return sizeof($this->notes->where("owner", $user->getId())->where("deleted", 0));
} }
} }