Don't set flags relationship on non-hydrated posts

This commit is contained in:
Toby Zerner 2015-10-14 12:26:13 +10:30
parent dc6eb4d4ad
commit 8a1c5cf24c

View File

@ -119,10 +119,12 @@ class AddPostFlagsRelationship
$postsWithPermission = [];
foreach ($posts as $post) {
$post->setRelation('flags', null);
if (is_object($post)) {
$post->setRelation('flags', null);
if ($actor->can('viewFlags', $post->discussion)) {
$postsWithPermission[] = $post;
if ($actor->can('viewFlags', $post->discussion)) {
$postsWithPermission[] = $post;
}
}
}