From eed1b9cbd006ce48606107c4537d4a029a5f7843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Klabbers?= Date: Wed, 1 Apr 2020 14:40:40 +0200 Subject: [PATCH] fixed an issue with Post--by-start-user for discussions that contain posts of deleted users --- framework/core/js/src/forum/components/Post.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/framework/core/js/src/forum/components/Post.js b/framework/core/js/src/forum/components/Post.js index 4b4d51ad2..d73e50df0 100644 --- a/framework/core/js/src/forum/components/Post.js +++ b/framework/core/js/src/forum/components/Post.js @@ -100,22 +100,24 @@ export default class Post extends Component { /** * Get the post's classes. - * + * * @param string classes * @returns {string[]} */ classes(existing) { let classes = (existing || '').split(' ').concat(['Post']); + const user = this.props.post.user(); + if (this.loading) { classes.push('Post--loading'); } - if (this.props.post.user() === app.session.user) { + if (user && user === app.session.user) { 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') }