Fixed partial user bug

This commit is contained in:
hydrabolt
2015-10-07 20:36:55 +01:00
parent c5d316f0bf
commit 083ed54274
3 changed files with 15 additions and 9 deletions

View File

@@ -1074,6 +1074,12 @@ var Client = (function () {
if (userInCache) {
//user exists
data.user.username = data.user.username || userInCache.username;
data.user.id = data.user.id || userInCache.id;
data.user.discriminator = data.user.discriminator || userInCache.discriminator;
data.user.avatar = data.user.avatar || userInCache.avatar;
var presenceUser = new User(data.user);
if (presenceUser.equalsStrict(userInCache)) {
//they're exactly the same, an actual presence update
@@ -1086,8 +1092,8 @@ var Client = (function () {
});
} else {
//one of their details changed.
self.trigger("userUpdate", userInCache, presenceUser);
self.userCache[self.userCache.indexOf(userInCache)] = presenceUser;
self.trigger("userUpdate", userInCache, presenceUser);
}
}