mirror of
https://github.com/flarum/core.git
synced 2025-08-14 12:24:33 +02:00
Don't set flags relationship on non-hydrated posts
This commit is contained in:
@@ -119,12 +119,14 @@ class AddPostFlagsRelationship
|
|||||||
$postsWithPermission = [];
|
$postsWithPermission = [];
|
||||||
|
|
||||||
foreach ($posts as $post) {
|
foreach ($posts as $post) {
|
||||||
|
if (is_object($post)) {
|
||||||
$post->setRelation('flags', null);
|
$post->setRelation('flags', null);
|
||||||
|
|
||||||
if ($actor->can('viewFlags', $post->discussion)) {
|
if ($actor->can('viewFlags', $post->discussion)) {
|
||||||
$postsWithPermission[] = $post;
|
$postsWithPermission[] = $post;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (count($postsWithPermission)) {
|
if (count($postsWithPermission)) {
|
||||||
(new Collection($postsWithPermission))
|
(new Collection($postsWithPermission))
|
||||||
|
Reference in New Issue
Block a user