1
0
Fork 0
mirror of synced 2024-07-04 06:00:53 +12:00

Fix list document total

This commit is contained in:
Jake Barnby 2023-04-10 20:51:38 +12:00
parent a91ee7e80f
commit e123188b0a
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -2910,7 +2910,8 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents')
$documentSecurity = $collection->getAttribute('documentSecurity', false);
$validator = new Authorization(Database::PERMISSION_READ);
if (!$validator->isValid($collection->getRead())) {
$valid = $validator->isValid($collection->getRead());
if (!$valid) {
$total = $documentSecurity
? $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries, APP_LIMIT_COUNT)
: 0;
@ -2979,6 +2980,10 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents')
foreach ($documents as $index => $document) {
if (!$processDocument($collection, $document)) {
unset($documents[$index]);
if ($valid) {
$total--;
}
}
}