mirror of
https://github.com/flarum/core.git
synced 2025-08-24 09:03:05 +02:00
Compare commits
4 Commits
dk/fix-tim
...
dw/fix-pos
Author | SHA1 | Date | |
---|---|---|---|
|
2ff15a06bf | ||
|
0ea2504602 | ||
|
0d0eb69980 | ||
|
c34b8cd1c2 |
@@ -6,6 +6,7 @@ import PostControls from '../utils/PostControls';
|
|||||||
import listItems from '../../common/helpers/listItems';
|
import listItems from '../../common/helpers/listItems';
|
||||||
import ItemList from '../../common/utils/ItemList';
|
import ItemList from '../../common/utils/ItemList';
|
||||||
import LoadingIndicator from '../../common/components/LoadingIndicator';
|
import LoadingIndicator from '../../common/components/LoadingIndicator';
|
||||||
|
import classList from '../../common/utils/classList';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `Post` component displays a single post. The basic post template just
|
* The `Post` component displays a single post. The basic post template just
|
||||||
@@ -124,24 +125,16 @@ export default class Post extends Component {
|
|||||||
* @returns {string[]}
|
* @returns {string[]}
|
||||||
*/
|
*/
|
||||||
classes(existing) {
|
classes(existing) {
|
||||||
let classes = (existing || '').split(' ').concat(['Post']);
|
|
||||||
|
|
||||||
const user = this.attrs.post.user();
|
const user = this.attrs.post.user();
|
||||||
const discussion = this.attrs.post.discussion();
|
const discussion = this.attrs.post.discussion();
|
||||||
|
|
||||||
if (this.loading) {
|
return classList(existing, 'Post', {
|
||||||
classes.push('Post--loading');
|
'Post--loading': this.loading,
|
||||||
}
|
'Post--by-actor': user === app.session.user,
|
||||||
|
'Post--by-start-user': user?.id() === discussion.attribute('startUserId'),
|
||||||
if (user && user === app.session.user) {
|
})
|
||||||
classes.push('Post--by-actor');
|
.split(' ')
|
||||||
}
|
.filter((x) => !!x);
|
||||||
|
|
||||||
if (user && user.id() === discussion.attribute('startUserId')) {
|
|
||||||
classes.push('Post--by-start-user');
|
|
||||||
}
|
|
||||||
|
|
||||||
return classes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user