From dc76fc5b987d96e58edbceb8d020c85a8e8ba622 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Mon, 16 May 2016 01:59:30 -0500 Subject: [PATCH] fix(account): JSON without `label` should not reset label --- src/flux/models/account.es6 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/flux/models/account.es6 b/src/flux/models/account.es6 index 758d1712e..0579d2e2a 100644 --- a/src/flux/models/account.es6 +++ b/src/flux/models/account.es6 @@ -87,10 +87,12 @@ export default class Account extends ModelWithMetadata { this.syncState = this.syncState || "running"; } - fromJSON(inJSON) { - const json = inJSON; - json.label = json.label || json[Account.attributes.emailAddress.jsonKey] - return super.fromJSON(json) + fromJSON(json) { + super.fromJSON(json); + if (!this.label) { + this.label = this.emailAddress; + } + return this; } // Returns a {Contact} model that represents the current user.