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 52ee0e24f4
commit 0b4454c9c5

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}>