FIX: Do not reload card if already loaded (#14129)

This changes include some used for making it easier to extend user card
functionality.
This commit is contained in:
Bianca Nenciu 2021-09-20 19:00:04 +03:00 committed by GitHub
parent dfeca42bf8
commit 5e8a42e55b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -39,7 +39,7 @@ export default Mixin.create({
isFixed: false,
isDocked: false,
_show(username, target) {
_show(username, target, event) {
// No user card for anon
if (this.siteSettings.hide_user_profiles_from_public && !this.currentUser) {
return false;
@ -54,8 +54,11 @@ export default Mixin.create({
return false;
}
this.set("lastEvent", event);
const currentUsername = this.username;
if (username === currentUsername && this.loading === username) {
if (username === currentUsername || this.loading === username) {
this._positionCard($(target));
return;
}
@ -152,11 +155,10 @@ export default Mixin.create({
event.preventDefault();
event.stopPropagation();
return this._show(transformText(matchingEl), matchingEl);
}
{
return false;
return this._show(transformText(matchingEl), matchingEl, event);
}
return false;
},
_topicHeaderTrigger(username, $target) {
@ -302,6 +304,7 @@ export default Mixin.create({
visible: false,
username: null,
loading: null,
lastEvent: null,
cardTarget: null,
post: null,
isFixed: false,