mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 19:30:23 -06:00
minor debouncing fixes for user card
This commit is contained in:
parent
20fa95801c
commit
7b484937d0
@ -7,6 +7,7 @@ export default ObjectController.extend({
|
||||
username: null,
|
||||
participant: null,
|
||||
avatar: null,
|
||||
userLoading: null,
|
||||
|
||||
postStream: Em.computed.alias('controllers.topic.postStream'),
|
||||
enoughPostsForFiltering: Em.computed.gte('participant.post_count', 2),
|
||||
@ -60,6 +61,11 @@ export default ObjectController.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
if (username === currentUsername && this.get('userLoading') === username) {
|
||||
// debounce
|
||||
return;
|
||||
}
|
||||
|
||||
this.set('participant', null);
|
||||
|
||||
// Retrieve their participants info
|
||||
@ -70,8 +76,12 @@ export default ObjectController.extend({
|
||||
|
||||
var self = this;
|
||||
self.set('user', null);
|
||||
|
||||
self.set('userLoading', username);
|
||||
Discourse.User.findByUsername(username).then(function (user) {
|
||||
self.setProperties({ user: user, avatar: user, visible: true});
|
||||
}).finally(function(){
|
||||
self.set('userLoading', null);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -33,6 +33,10 @@ export default Discourse.View.extend(CleansUp, {
|
||||
if ($target.closest('.trigger-user-card').length > 0) { return; }
|
||||
if (self.$().has(e.target).length !== 0) { return; }
|
||||
|
||||
if ($target.data("userCard")|| $target.closest('a.mention')) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.get('controller').close();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user