From 65a584546668cbe211020053c3bddcfc38e04d9c Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sun, 27 Dec 2015 21:46:37 -0800 Subject: [PATCH] Allow us to see our own messages, but ignore name changes. --- static/babystats.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/static/babystats.js b/static/babystats.js index 5f73f01..22178b4 100644 --- a/static/babystats.js +++ b/static/babystats.js @@ -55,7 +55,7 @@ BabyStats.prototype.onChatReady_ = function(chat) { this.buildGrid_(); var messages = this.chat_.getMessages(); - messages.forEach(this.handleMessage_.bind(this)); + messages.forEach(this.handleMessage_.bind(this, false)); this.chat_.addEventListener('message', this.onMessage_.bind(this)); }; @@ -65,18 +65,19 @@ BabyStats.prototype.onChatReady_ = function(chat) { * @private */ BabyStats.prototype.onMessage_ = function(e) { - this.handleMessage_(e.detail); + this.handleMessage_(true, e.detail); }; /** + * @param {Boolean} isEvent * @param {Cosmopolite.typeMessage} message * @private */ -BabyStats.prototype.handleMessage_ = function(message) { +BabyStats.prototype.handleMessage_ = function(isEvent, message) { switch (message.message.type) { case 'child_name_change': - if (e.detail.sender != this.cosmo_.currentProfile()) { + if (!isEvent || message.sender != this.cosmo_.currentProfile()) { this.childName_.value = message.message.child_name; this.checkOverlay_(); }