Skip to content

A platform for community discussion. Free, open, simple.

DEV: add app event for user-card:after-show (#15227)

Jeff Wong51abcd7524bb
diff --git a/app/assets/javascripts/discourse/app/components/user-card-contents.js b/app/assets/javascripts/discourse/app/components/user-card-contents.js
index 3c64c2fc839..db6621cc71d 100644
--- a/app/assets/javascripts/discourse/app/components/user-card-contents.js
+++ b/app/assets/javascripts/discourse/app/components/user-card-contents.js
@@ -174,7 +174,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
include_post_count_for: this.get("topic.id"),
};
- User.findByUsername(username, args)
+ return User.findByUsername(username, args)
.then((user) => {
if (user.topic_post_count) {
this.set(
@@ -183,6 +183,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
);
}
this.setProperties({ user });
+ return user;
})
.catch(() => this._close())
.finally(() => this.set("loading", null));
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 d5843e9afb2..b56179c7340 100644
--- a/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
+++ b/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
@@ -86,7 +86,9 @@ export default Mixin.create({
});
this.appEvents.trigger("user-card:show", { username });
- this._showCallback(username, $(target));
+ this._showCallback(username, $(target)).then((user) => {
+ this.appEvents.trigger("user-card:after-show", { user });
+ });
// We bind scrolling on mobile after cards are shown to hide them if user scrolls
if (this.site.mobileView) {