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

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

This changes include some used for making it easier to extend user card functionality.

diff --git a/app/assets/javascripts/discourse/app/mixins/card-contents-base.js b/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
index 2a1f1b2..299d27f 100644
--- a/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
+++ b/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
@@ -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,

GitHub sha: 5e8a42e55b683cb9e1a1077574177c78d3fbf853

This commit appears in #14129 which was approved by ZogStriP. It was merged by nbianca.