Skip to content

Commit

Permalink
Fix error when unset user email
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco129 committed May 13, 2016
1 parent 19e7407 commit 1221901
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions spec/ParseUser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
done();
}, (error) => {
fail('Should not fail');
done();
});
});

it('create session from user', (done) => {
Parse.Promise.as().then(() => {
return Parse.User.signUp("finn", "human", { foo: "bar" });
Expand Down
2 changes: 1 addition & 1 deletion src/RestWrite.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1221901

Please sign in to comment.