From b32496d30c82d4c1931f75ded9b3fdea22d8f788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sat, 14 Aug 2021 01:22:56 +0300 Subject: [PATCH] don't show excerpt if there are no plain content (#2964) for https://github.com/flarum/core/issues/2942 --- js/src/forum/components/PostPreview.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/forum/components/PostPreview.js b/js/src/forum/components/PostPreview.js index 14b51fccf..f13715dcc 100644 --- a/js/src/forum/components/PostPreview.js +++ b/js/src/forum/components/PostPreview.js @@ -16,7 +16,8 @@ export default class PostPreview extends Component { view() { const post = this.attrs.post; const user = post.user(); - const excerpt = highlight(post.contentPlain(), this.attrs.highlight, 300); + const content = post.contentType() === 'comment' && post.contentPlain(); + const excerpt = content ? highlight(content, this.attrs.highlight, 300) : ''; return (