Fix issue with two open windows on the same profile can't see each others' name changes.

This commit is contained in:
Ian Gulliver
2015-12-30 09:38:12 -08:00
parent fab34b428d
commit 820107e50b

View File

@@ -65,6 +65,7 @@ var BabyStats = function(container) {
this.intervals_ = {};
this.cosmo_ = new Cosmopolite();
this.client_id_ = this.cosmo_.uuid();
hogfather.PublicChat.Join(this.cosmo_, id).then(this.onChatReady_.bind(this));
};
@@ -122,7 +123,7 @@ BabyStats.prototype.findTile_ = function(type) {
BabyStats.prototype.handleMessage_ = function(isEvent, message) {
switch (message.message.type) {
case 'child_name_change':
if (!isEvent || message.sender != this.cosmo_.currentProfile()) {
if (!isEvent || message.message.client_id != this.client_id_) {
this.childName_.value = message.message.child_name;
this.checkOverlay_();
}
@@ -591,6 +592,7 @@ BabyStats.prototype.onChildNameChange_ = function() {
this.chat_.sendMessage({
type: 'child_name_change',
child_name: this.childName_.value,
client_id: this.client_id_,
});
};