mirror of
https://github.com/flarum/framework.git
synced 2025-02-20 14:52:01 +08:00
Fix non-comment post content serialization
This commit is contained in:
parent
193bb0b085
commit
c35b472e66
|
@ -56,6 +56,6 @@ class DiscussionBasicSerializer extends BaseSerializer
|
||||||
|
|
||||||
public function addedPosts()
|
public function addedPosts()
|
||||||
{
|
{
|
||||||
return $this->hasMany('Flarum\Api\Serializers\PostBasicSerializer');
|
return $this->hasMany('Flarum\Api\Serializers\PostSerializer');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class PostBasicSerializer extends BaseSerializer
|
||||||
if ($post->type === 'comment') {
|
if ($post->type === 'comment') {
|
||||||
$attributes['content'] = str_limit($post->content, 200);
|
$attributes['content'] = str_limit($post->content, 200);
|
||||||
} else {
|
} else {
|
||||||
$attributes['content'] = json_encode($post->content);
|
$attributes['content'] = $post->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->extendAttributes($post, $attributes);
|
return $this->extendAttributes($post, $attributes);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user