From 830f48a212c4cde287972649b35114549136d5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Klabbers?= Date: Mon, 11 Nov 2019 12:58:33 +0100 Subject: [PATCH] Improved naming of class for post by actor. Made class list for post extensible by using a separate method. --- framework/core/js/src/forum/components/Post.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/framework/core/js/src/forum/components/Post.js b/framework/core/js/src/forum/components/Post.js index 5b410f684..b3e73386f 100644 --- a/framework/core/js/src/forum/components/Post.js +++ b/framework/core/js/src/forum/components/Post.js @@ -39,7 +39,7 @@ export default class Post extends Component { view() { const attrs = this.attrs(); - attrs.className = 'Post ' + (this.loading ? 'Post--loading ' : '') + (this.props.post.user() === app.session.user ? 'Post--self' : '') + (attrs.className || ''); + attrs.className = this.classes().join(' '); return (
@@ -98,6 +98,20 @@ export default class Post extends Component { return []; } + classes() { + let classes = ['Post']; + + if (this.loading) { + classes.push('Post--loading'); + } + + if (this.props.post.user() === app.session.user) { + classes.push('Post--by-actor'); + } + + return classes; + } + /** * Build an item list for the post's actions. *