1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 09:26:34 +02:00

replace href and config with route on PostPreview (which is unused, also, update the component

This commit is contained in:
Alexander Skvortsov
2020-08-10 00:40:05 -04:00
committed by Franz Liedke
parent 8a0c241a8e
commit 16a6f82e8f

View File

@@ -7,18 +7,18 @@ import highlight from '../../common/helpers/highlight';
* The `PostPreview` component shows a link to a post containing the avatar and * The `PostPreview` component shows a link to a post containing the avatar and
* username of the author, and a short excerpt of the post's content. * username of the author, and a short excerpt of the post's content.
* *
* ### Props * ### Attrs
* *
* - `post` * - `post`
*/ */
export default class PostPreview extends Component { export default class PostPreview extends Component {
view() { view() {
const post = this.props.post; const post = this.attrs.post;
const user = post.user(); const user = post.user();
const excerpt = highlight(post.contentPlain(), this.props.highlight, 300); const excerpt = highlight(post.contentPlain(), this.attrs.highlight, 300);
return ( return (
<a className="PostPreview" href={app.route.post(post)} config={m.route} onclick={this.props.onclick}> <a className="PostPreview" route={app.route.post(post)} onclick={this.attrs.onclick}>
<span className="PostPreview-content"> <span className="PostPreview-content">
{avatar(user)} {avatar(user)}
{username(user)} <span className="PostPreview-excerpt">{excerpt}</span> {username(user)} <span className="PostPreview-excerpt">{excerpt}</span>