diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-04-28 10:55:07 -0400 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-04-28 07:55:07 -0700 |
commit | 65a2427b90f3261d895f6b64a771d2362e896cb6 (patch) | |
tree | 9333b1ad797e8e7dbaa64b813a91e1c2c12a3f2a | |
parent | b07f8272d6a99db2b7d4094961ffe0650b282bb7 (diff) | |
download | chat-65a2427b90f3261d895f6b64a771d2362e896cb6.tar.gz chat-65a2427b90f3261d895f6b64a771d2362e896cb6.tar.bz2 chat-65a2427b90f3261d895f6b64a771d2362e896cb6.zip |
Update {user} is typing.. based on display name setting (#2817)
-rw-r--r-- | webapp/stores/user_typing_store.jsx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/webapp/stores/user_typing_store.jsx b/webapp/stores/user_typing_store.jsx index ab0a9af1d..85c10bfbe 100644 --- a/webapp/stores/user_typing_store.jsx +++ b/webapp/stores/user_typing_store.jsx @@ -33,16 +33,16 @@ class UserTypingStoreClass extends EventEmitter { this.removeListener(CHANGE_EVENT, callback); } - usernameFromId(userId) { - let username = Utils.localizeMessage('msg_typing.someone', 'Someone'); + nameFromId(userId) { + let name = Utils.localizeMessage('msg_typing.someone', 'Someone'); if (UserStore.hasProfile(userId)) { - username = UserStore.getProfile(userId).username; + name = Utils.displayUsername(userId); } - return username; + return name; } userTyping(channelId, userId, postParentId) { - const username = this.usernameFromId(userId); + const name = this.nameFromId(userId); // Key representing a location where users can type const loc = channelId + postParentId; @@ -53,15 +53,15 @@ class UserTypingStoreClass extends EventEmitter { } // If we already have this user, clear it's timeout to be deleted - if (this.typingUsers[loc][username]) { - clearTimeout(this.typingUsers[loc][username].timeout); + if (this.typingUsers[loc][name]) { + clearTimeout(this.typingUsers[loc][name].timeout); } // Set the user and a timeout to remove it - this.typingUsers[loc][username] = setTimeout(() => { - delete this.typingUsers[loc][username]; + this.typingUsers[loc][name] = setTimeout(() => { + Reflect.deleteProperty(this.typingUsers[loc], name); if (this.typingUsers[loc] === {}) { - delete this.typingUsers[loc]; + Reflect.deleteProperty(this.typingUsers, loc); } this.emitChange(); }, Constants.UPDATE_TYPING_MS); @@ -76,14 +76,14 @@ class UserTypingStoreClass extends EventEmitter { } userPosted(userId, channelId, postParentId) { - const username = this.usernameFromId(userId); + const name = this.nameFromId(userId); const loc = channelId + postParentId; if (this.typingUsers[loc]) { - clearTimeout(this.typingUsers[loc][username]); - delete this.typingUsers[loc][username]; + clearTimeout(this.typingUsers[loc][name]); + Reflect.deleteProperty(this.typingUsers[loc], name); if (this.typingUsers[loc] === {}) { - delete this.typingUsers[loc]; + Reflect.deleteProperty(this.typingUsers, loc); } this.emitChange(); } |