Performance: Load only basic information about post discussion/users

This commit is contained in:
Toby Zerner 2017-11-11 23:15:36 +10:30
parent dedcbae359
commit 3c80612d80

View File

@ -85,7 +85,7 @@ class PostSerializer extends PostBasicSerializer
*/
protected function discussion($post)
{
return $this->hasOne($post, 'Flarum\Api\Serializer\DiscussionSerializer');
return $this->hasOne($post, 'Flarum\Api\Serializer\DiscussionBasicSerializer');
}
/**
@ -93,7 +93,7 @@ class PostSerializer extends PostBasicSerializer
*/
protected function editUser($post)
{
return $this->hasOne($post, 'Flarum\Api\Serializer\UserSerializer');
return $this->hasOne($post, 'Flarum\Api\Serializer\UserBasicSerializer');
}
/**
@ -101,6 +101,6 @@ class PostSerializer extends PostBasicSerializer
*/
protected function hideUser($post)
{
return $this->hasOne($post, 'Flarum\Api\Serializer\UserSerializer');
return $this->hasOne($post, 'Flarum\Api\Serializer\UserBasicSerializer');
}
}