mirror of
https://github.com/flarum/framework.git
synced 2025-02-17 12:12:52 +08:00
bugfix when posts is not needed when showing discussion (#17)
When accessing /api/discussion/[id]?include=user, NOTICE occurs
This commit is contained in:
parent
979030432f
commit
8ec05c4905
|
@ -100,7 +100,9 @@ class AddPostFlagsRelationship
|
|||
// models) so that we can selectively expose only the flags that the
|
||||
// user has permission to view.
|
||||
if ($event->isController(Controller\ShowDiscussionController::class)) {
|
||||
$posts = $event->data->getRelation('posts');
|
||||
if ($event->data->relationLoaded('posts')) {
|
||||
$posts = $event->data->getRelation('posts');
|
||||
}
|
||||
}
|
||||
|
||||
if ($event->isController(Controller\ListPostsController::class)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user