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

Adds user-card:after-show event for when a usercard is fully loaded and shown.
This commit is contained in:
Jeff Wong 2021-12-08 13:23:39 -10:00 committed by GitHub
parent 3b0d46c659
commit 51abcd7524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -174,7 +174,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
include_post_count_for: this.get("topic.id"), include_post_count_for: this.get("topic.id"),
}; };
User.findByUsername(username, args) return User.findByUsername(username, args)
.then((user) => { .then((user) => {
if (user.topic_post_count) { if (user.topic_post_count) {
this.set( this.set(
@ -183,6 +183,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
); );
} }
this.setProperties({ user }); this.setProperties({ user });
return user;
}) })
.catch(() => this._close()) .catch(() => this._close())
.finally(() => this.set("loading", null)); .finally(() => this.set("loading", null));

View File

@ -86,7 +86,9 @@ export default Mixin.create({
}); });
this.appEvents.trigger("user-card:show", { username }); 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 // We bind scrolling on mobile after cards are shown to hide them if user scrolls
if (this.site.mobileView) { if (this.site.mobileView) {