1
0
mirror of https://github.com/flarum/core.git synced 2025-07-11 20:06:23 +02:00

Don't store PostUser instance in CommentPost (#2184)

* Don't save component state in CommentPost
This commit is contained in:
Alexander Skvortsov
2020-06-18 20:10:25 -04:00
committed by GitHub
parent ed566cd18f
commit 62fe9db732
2 changed files with 6 additions and 31 deletions

View File

@ -13,15 +13,6 @@ import listItems from '../../common/helpers/listItems';
* - `post`
*/
export default class PostUser extends Component {
init() {
/**
* Whether or not the user hover card is visible.
*
* @type {Boolean}
*/
this.cardVisible = false;
}
view() {
const post = this.props.post;
const user = post.user();
@ -38,7 +29,7 @@ export default class PostUser extends Component {
let card = '';
if (!post.isHidden() && this.cardVisible) {
if (!post.isHidden()) {
card = UserCard.component({
user,
className: 'UserCard--popover',
@ -81,10 +72,6 @@ export default class PostUser extends Component {
* Show the user card.
*/
showCard() {
this.cardVisible = true;
m.redraw();
setTimeout(() => this.$('.UserCard').addClass('in'));
}
@ -92,11 +79,6 @@ export default class PostUser extends Component {
* Hide the user card.
*/
hideCard() {
this.$('.UserCard')
.removeClass('in')
.one('transitionend webkitTransitionEnd oTransitionEnd', () => {
this.cardVisible = false;
m.redraw();
});
this.$('.UserCard').removeClass('in');
}
}