fix(Users): Makes sure verifying emails triggers hooks and liveQuery (#3851)

* Use RestWrite when verifying emails so hooks are called (as master)

* Fixes tests for postgres

* nit

* Makes rest.update support a full where instead of objectId

* Use rest.update to guaranteed proper beforeSave and liveQuery calls
This commit is contained in:
Florent Vilmart
2017-05-28 20:34:49 -04:00
committed by GitHub
parent 73aafa2d24
commit c2abbae92d
7 changed files with 29 additions and 31 deletions

View File

@@ -64,7 +64,7 @@ describe('rest create', () => {
expect(mob.subdoc.wu).toBe('tan');
expect(typeof mob.objectId).toEqual('string');
const obj = { 'subdoc.wu': 'clan' };
return rest.update(config, auth.nobody(config), 'MyClass', mob.objectId, obj)
return rest.update(config, auth.nobody(config), 'MyClass', { objectId: mob.objectId }, obj)
})
.then(() => database.adapter.find('MyClass', { fields: {} }, {}, {}))
.then(results => {
@@ -195,7 +195,7 @@ describe('rest create', () => {
objectId = r.response.objectId;
return auth.getAuthForSessionToken({config, sessionToken: r.response.sessionToken })
}).then((sessionAuth) => {
return rest.update(config, sessionAuth, '_User', objectId, updatedData);
return rest.update(config, sessionAuth, '_User', { objectId }, updatedData);
}).then(() => {
return Parse.User.logOut().then(() => {
return Parse.User.logIn('hello', 'world');
@@ -435,7 +435,7 @@ describe('rest update', () => {
createdAt: {__type: "Date", iso: newCreatedAt}, // should be ignored
};
return rest.update(config, nobody, className, objectId, restObject).then(() => {
return rest.update(config, nobody, className, { objectId }, restObject).then(() => {
const restWhere = {
objectId: objectId,
};