don't show excerpt if there are no plain content (#2964)

for https://github.com/flarum/core/issues/2942
This commit is contained in:
Hasan Özbey 2021-08-14 01:22:56 +03:00 committed by GitHub
parent d8c112088d
commit b32496d30c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 (
<Link className="PostPreview" href={app.route.post(post)} onclick={this.attrs.onclick}>