1
0
mirror of https://github.com/flarum/core.git synced 2025-07-25 10:41:24 +02:00

fixed an issue with Post--by-start-user for discussions that contain posts of deleted users

This commit is contained in:
Daniël Klabbers
2020-04-01 14:40:40 +02:00
parent 76fcd7faac
commit eed1b9cbd0

View File

@@ -100,22 +100,24 @@ export default class Post extends Component {
/** /**
* Get the post's classes. * Get the post's classes.
* *
* @param string classes * @param string classes
* @returns {string[]} * @returns {string[]}
*/ */
classes(existing) { classes(existing) {
let classes = (existing || '').split(' ').concat(['Post']); let classes = (existing || '').split(' ').concat(['Post']);
const user = this.props.post.user();
if (this.loading) { if (this.loading) {
classes.push('Post--loading'); classes.push('Post--loading');
} }
if (this.props.post.user() === app.session.user) { if (user && user === app.session.user) {
classes.push('Post--by-actor'); classes.push('Post--by-actor');
} }
if (app.current.discussion && app.current.discussion.attribute('startUserId') == this.props.post.user().id()) { if (user && app.current.discussion && app.current.discussion.attribute('startUserId') == user.id()) {
classes.push('Post--by-start-user') classes.push('Post--by-start-user')
} }