1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

References: Fixed references count/list recycle bin interaction

Count and reference list would get references then attempt to load
entities, which could fail to load if in the recycle bin.
This updates the queries to effectively ignore references for items we
can't see (in recycle bin).
Added test to cover.

For #4918
This commit is contained in:
Dan Brown
2024-04-01 17:08:53 +01:00
parent 58f6219cb3
commit a33dbcb04a
2 changed files with 27 additions and 2 deletions

View File

@ -41,7 +41,8 @@ class ReferenceFetcher
{
$baseQuery = Reference::query()
->where('to_type', '=', $entity->getMorphClass())
->where('to_id', '=', $entity->id);
->where('to_id', '=', $entity->id)
->whereHas('from');
return $this->permissions->restrictEntityRelationQuery(
$baseQuery,