fix(account): JSON without label should not reset label

This commit is contained in:
Ben Gotow 2016-05-16 01:59:30 -05:00
parent b3b6276f4e
commit dc76fc5b98

View file

@ -87,10 +87,12 @@ export default class Account extends ModelWithMetadata {
this.syncState = this.syncState || "running"; this.syncState = this.syncState || "running";
} }
fromJSON(inJSON) { fromJSON(json) {
const json = inJSON; super.fromJSON(json);
json.label = json.label || json[Account.attributes.emailAddress.jsonKey] if (!this.label) {
return super.fromJSON(json) this.label = this.emailAddress;
}
return this;
} }
// Returns a {Contact} model that represents the current user. // Returns a {Contact} model that represents the current user.