diff --git a/spec/ParseUser.spec.js b/spec/ParseUser.spec.js index 0873f4426f..ce9763af89 100644 --- a/spec/ParseUser.spec.js +++ b/spec/ParseUser.spec.js @@ -1834,6 +1834,22 @@ describe('Parse.User testing', () => { }); }); + it('unset user email', (done) => { + var user = new Parse.User(); + user.set('username', 'test'); + user.set('password', 'test'); + user.set('email', 'test@test.com'); + user.signUp().then(() => { + user.unset('email'); + return user.save(); + }).then(() => { + return Parse.User.logIn('test', 'test'); + }).then((user) => { + expect(user.getEmail()).toBeUndefined(); + done(); + }); + }); + it('create session from user', (done) => { Parse.Promise.as().then(() => { return Parse.User.signUp("finn", "human", { foo: "bar" }); diff --git a/src/RestWrite.js b/src/RestWrite.js index 03138e44f4..ecb92a85e4 100644 --- a/src/RestWrite.js +++ b/src/RestWrite.js @@ -356,7 +356,7 @@ RestWrite.prototype.transformUser = function() { return Promise.resolve(); }); }).then(() => { - if (!this.data.email) { + if (!this.data.email || this.data.email.__op === 'Delete') { return; } // Validate basic email address format