mirror of
https://github.com/flarum/core.git
synced 2025-07-10 03:16:22 +02:00
Fix user card issue by reverting to original behavior (#2224)
* Fix user card issue by reverting to original behavior
This commit is contained in:
@ -31,7 +31,18 @@ export default class CommentPost extends Post {
|
|||||||
*/
|
*/
|
||||||
this.revealContent = false;
|
this.revealContent = false;
|
||||||
|
|
||||||
this.subtree.check(() => this.isEditing());
|
/**
|
||||||
|
* Whether or not the user hover card inside of PostUser is visible.
|
||||||
|
* The property must be managed in CommentPost to be able to use it in the subtree check
|
||||||
|
*
|
||||||
|
* @type {Boolean}
|
||||||
|
*/
|
||||||
|
this.cardVisible = false;
|
||||||
|
|
||||||
|
this.subtree.check(
|
||||||
|
() => this.cardVisible,
|
||||||
|
() => this.isEditing()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
content() {
|
content() {
|
||||||
@ -124,7 +135,22 @@ export default class CommentPost extends Post {
|
|||||||
const items = new ItemList();
|
const items = new ItemList();
|
||||||
const post = this.props.post;
|
const post = this.props.post;
|
||||||
|
|
||||||
items.add('user', PostUser.component({ post }), 100);
|
items.add(
|
||||||
|
'user',
|
||||||
|
PostUser.component({
|
||||||
|
post,
|
||||||
|
cardVisible: this.cardVisible,
|
||||||
|
oncardshow: () => {
|
||||||
|
this.cardVisible = true;
|
||||||
|
m.redraw();
|
||||||
|
},
|
||||||
|
oncardhide: () => {
|
||||||
|
this.cardVisible = false;
|
||||||
|
m.redraw();
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
100
|
||||||
|
);
|
||||||
items.add('meta', PostMeta.component({ post }));
|
items.add('meta', PostMeta.component({ post }));
|
||||||
|
|
||||||
if (post.isEdited() && !post.isHidden()) {
|
if (post.isEdited() && !post.isHidden()) {
|
||||||
|
@ -29,7 +29,7 @@ export default class PostUser extends Component {
|
|||||||
|
|
||||||
let card = '';
|
let card = '';
|
||||||
|
|
||||||
if (!post.isHidden()) {
|
if (!post.isHidden() && this.props.cardVisible) {
|
||||||
card = UserCard.component({
|
card = UserCard.component({
|
||||||
user,
|
user,
|
||||||
className: 'UserCard--popover',
|
className: 'UserCard--popover',
|
||||||
@ -72,6 +72,8 @@ export default class PostUser extends Component {
|
|||||||
* Show the user card.
|
* Show the user card.
|
||||||
*/
|
*/
|
||||||
showCard() {
|
showCard() {
|
||||||
|
this.props.oncardshow();
|
||||||
|
|
||||||
setTimeout(() => this.$('.UserCard').addClass('in'));
|
setTimeout(() => this.$('.UserCard').addClass('in'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +81,10 @@ export default class PostUser extends Component {
|
|||||||
* Hide the user card.
|
* Hide the user card.
|
||||||
*/
|
*/
|
||||||
hideCard() {
|
hideCard() {
|
||||||
this.$('.UserCard').removeClass('in');
|
this.$('.UserCard')
|
||||||
|
.removeClass('in')
|
||||||
|
.one('transitionend webkitTransitionEnd oTransitionEnd', () => {
|
||||||
|
this.props.oncardhide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user