Skip to content

Commit 48e23fc

Browse files
authored
Merge branch 'alpha' into realDBAdapterLoader
2 parents bcccf2c + abdba68 commit 48e23fc

16 files changed

+177
-49
lines changed

changelogs/CHANGELOG_alpha.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# [7.0.0-alpha.9](https://github.com/parse-community/parse-server/compare/7.0.0-alpha.8...7.0.0-alpha.9) (2024-01-15)
2+
3+
4+
### Bug Fixes
5+
6+
* Server crashes when receiving an array of `Parse.Pointer` in the request body ([#8784](https://github.com/parse-community/parse-server/issues/8784)) ([66e3603](https://github.com/parse-community/parse-server/commit/66e36039d8af654cfa0284666c0ddd94975dcb52))
7+
8+
# [7.0.0-alpha.8](https://github.com/parse-community/parse-server/compare/7.0.0-alpha.7...7.0.0-alpha.8) (2024-01-15)
9+
10+
11+
### Bug Fixes
12+
13+
* Incomplete user object in `verifyEmail` function if both username and email are changed ([#8889](https://github.com/parse-community/parse-server/issues/8889)) ([1eb95ae](https://github.com/parse-community/parse-server/commit/1eb95aeb41a96250e582d79a703f6adcb403c08b))
14+
15+
# [7.0.0-alpha.7](https://github.com/parse-community/parse-server/compare/7.0.0-alpha.6...7.0.0-alpha.7) (2024-01-14)
16+
17+
18+
### Bug Fixes
19+
20+
* Username is `undefined` in email verification link on email change ([#8887](https://github.com/parse-community/parse-server/issues/8887)) ([e315c13](https://github.com/parse-community/parse-server/commit/e315c137bf41bedfa8f0df537f2c3f6ab45b7e60))
21+
122
# [7.0.0-alpha.6](https://github.com/parse-community/parse-server/compare/7.0.0-alpha.5...7.0.0-alpha.6) (2024-01-14)
223

324

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "7.0.0-alpha.6",
3+
"version": "7.0.0-alpha.9",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {

spec/.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"fit_exclude_node_version": true,
2929
"it_exclude_dbs": true,
3030
"describe_only_db": true,
31+
"fdescribe_only_db": true,
3132
"describe_only": true,
3233
"on_db": true,
3334
"defaultConfiguration": true,

spec/EmailVerificationToken.spec.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ describe('Email Verification Token Expiration: ', () => {
127127
user.set('email', '[email protected]');
128128
return user.signUp();
129129
})
130+
.then(() => jasmine.timeout())
130131
.then(() => {
131132
request({
132133
url: sendEmailOptions.link,
@@ -168,6 +169,7 @@ describe('Email Verification Token Expiration: ', () => {
168169
user.set('email', '[email protected]');
169170
return user.signUp();
170171
})
172+
.then(() => jasmine.timeout())
171173
.then(() => {
172174
request({
173175
url: sendEmailOptions.link,
@@ -215,6 +217,7 @@ describe('Email Verification Token Expiration: ', () => {
215217
user.set('email', '[email protected]');
216218
return user.signUp();
217219
})
220+
.then(() => jasmine.timeout())
218221
.then(() => {
219222
request({
220223
url: sendEmailOptions.link,
@@ -388,6 +391,7 @@ describe('Email Verification Token Expiration: ', () => {
388391
user2.setPassword('expiringToken');
389392
user2.set('email', '[email protected]');
390393
await user2.signUp();
394+
await jasmine.timeout();
391395
expect(user2.getSessionToken()).toBeUndefined();
392396
expect(sendEmailOptions).toBeDefined();
393397
expect(verifySpy).toHaveBeenCalledTimes(5);
@@ -422,10 +426,47 @@ describe('Email Verification Token Expiration: ', () => {
422426
newUser.set('email', '[email protected]');
423427
await newUser.signUp();
424428
await Parse.User.requestEmailVerification('[email protected]');
429+
await jasmine.timeout();
425430
expect(sendSpy).toHaveBeenCalledTimes(2);
426431
expect(emailSpy).toHaveBeenCalledTimes(0);
427432
});
428433

434+
it('provides full user object in email verification function on email and username change', async () => {
435+
const emailAdapter = {
436+
sendVerificationEmail: () => {},
437+
sendPasswordResetEmail: () => Promise.resolve(),
438+
sendMail: () => {},
439+
};
440+
const sendVerificationEmail = {
441+
method(req) {
442+
expect(req.user).toBeDefined();
443+
expect(req.user.id).toBeDefined();
444+
expect(req.user.get('createdAt')).toBeDefined();
445+
expect(req.user.get('updatedAt')).toBeDefined();
446+
expect(req.master).toBeDefined();
447+
return false;
448+
},
449+
};
450+
await reconfigureServer({
451+
appName: 'emailVerifyToken',
452+
verifyUserEmails: true,
453+
emailAdapter: emailAdapter,
454+
emailVerifyTokenValidityDuration: 5,
455+
publicServerURL: 'http://localhost:8378/1',
456+
sendUserEmailVerification: sendVerificationEmail.method,
457+
});
458+
const user = new Parse.User();
459+
user.setPassword('password');
460+
user.setUsername('[email protected]');
461+
user.setEmail('[email protected]');
462+
await user.save(null, { useMasterKey: true });
463+
464+
// Update email and username
465+
user.setUsername('[email protected]');
466+
user.setEmail('[email protected]');
467+
await user.save(null, { useMasterKey: true });
468+
});
469+
429470
it('beforeSave options do not change existing behaviour', async () => {
430471
let sendEmailOptions;
431472
const emailAdapter = {
@@ -448,6 +489,7 @@ describe('Email Verification Token Expiration: ', () => {
448489
newUser.setPassword('expiringToken');
449490
newUser.set('email', '[email protected]');
450491
await newUser.signUp();
492+
await jasmine.timeout();
451493
const response = await request({
452494
url: sendEmailOptions.link,
453495
followRedirects: false,
@@ -490,6 +532,7 @@ describe('Email Verification Token Expiration: ', () => {
490532
user.set('email', '[email protected]');
491533
return user.signUp();
492534
})
535+
.then(() => jasmine.timeout())
493536
.then(() => {
494537
request({
495538
url: sendEmailOptions.link,
@@ -549,6 +592,7 @@ describe('Email Verification Token Expiration: ', () => {
549592
user.set('email', '[email protected]');
550593
return user.signUp();
551594
})
595+
.then(() => jasmine.timeout())
552596
.then(() => {
553597
return request({
554598
url: sendEmailOptions.link,
@@ -766,6 +810,9 @@ describe('Email Verification Token Expiration: ', () => {
766810
})
767811
.then(response => {
768812
expect(response.status).toBe(200);
813+
})
814+
.then(() => jasmine.timeout())
815+
.then(() => {
769816
expect(sendVerificationEmailCallCount).toBe(2);
770817
expect(sendEmailOptions).toBeDefined();
771818

@@ -917,6 +964,7 @@ describe('Email Verification Token Expiration: ', () => {
917964
'Content-Type': 'application/json',
918965
},
919966
});
967+
await jasmine.timeout();
920968
expect(response.status).toBe(200);
921969
expect(sendVerificationEmailCallCount).toBe(2);
922970
expect(sendEmailOptions).toBeDefined();
@@ -959,6 +1007,7 @@ describe('Email Verification Token Expiration: ', () => {
9591007
user.set('email', '[email protected]');
9601008
return user.signUp();
9611009
})
1010+
.then(() => jasmine.timeout())
9621011
.then(() => {
9631012
return request({
9641013
url: sendEmailOptions.link,
@@ -1197,6 +1246,7 @@ describe('Email Verification Token Expiration: ', () => {
11971246
user.set('email', '[email protected]');
11981247
return user.signUp();
11991248
})
1249+
.then(() => jasmine.timeout())
12001250
.then(() => {
12011251
request({
12021252
url: sendEmailOptions.link,

spec/PagesRouter.spec.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ describe('Pages Router', () => {
749749
user.setPassword('examplePassword');
750750
user.set('email', '[email protected]');
751751
await user.signUp();
752+
await jasmine.timeout();
752753

753754
const link = sendVerificationEmail.calls.all()[0].args[0].link;
754755
const linkWithLocale = new URL(link);
@@ -777,6 +778,7 @@ describe('Pages Router', () => {
777778
user.setPassword('examplePassword');
778779
user.set('email', '[email protected]');
779780
await user.signUp();
781+
await jasmine.timeout();
780782

781783
const link = sendVerificationEmail.calls.all()[0].args[0].link;
782784
const linkWithLocale = new URL(link);
@@ -830,6 +832,7 @@ describe('Pages Router', () => {
830832
user.setPassword('examplePassword');
831833
user.set('email', '[email protected]');
832834
await user.signUp();
835+
await jasmine.timeout();
833836

834837
const link = sendVerificationEmail.calls.all()[0].args[0].link;
835838
const linkWithLocale = new URL(link);
@@ -846,6 +849,8 @@ describe('Pages Router', () => {
846849
const locale = linkResponse.headers['x-parse-page-param-locale'];
847850
const username = linkResponse.headers['x-parse-page-param-username'];
848851
const publicServerUrl = linkResponse.headers['x-parse-page-param-publicserverurl'];
852+
await jasmine.timeout();
853+
849854
const invalidVerificationPagePath = pageResponse.calls.all()[0].args[0];
850855
expect(appId).toBeDefined();
851856
expect(locale).toBe(exampleLocale);
@@ -1190,14 +1195,14 @@ describe('Pages Router', () => {
11901195
user.setPassword('examplePassword');
11911196
user.set('email', '[email protected]');
11921197
await user.signUp();
1198+
await jasmine.timeout();
11931199

11941200
const link = sendVerificationEmail.calls.all()[0].args[0].link;
11951201
const linkResponse = await request({
11961202
url: link,
11971203
followRedirects: false,
11981204
});
11991205
expect(linkResponse.status).toBe(200);
1200-
12011206
const pagePath = pageResponse.calls.all()[0].args[0];
12021207
expect(pagePath).toMatch(new RegExp(`\/${pages.emailVerificationSuccess.defaultFile}`));
12031208
});

spec/Parse.Push.spec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
const request = require('../lib/request');
44

5-
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
6-
75
const pushCompleted = async pushId => {
86
const query = new Parse.Query('_PushStatus');
97
query.equalTo('objectId', pushId);
108
let result = await query.first({ useMasterKey: true });
119
while (!(result && result.get('status') === 'succeeded')) {
12-
await sleep(100);
10+
await jasmine.timeout();
1311
result = await query.first({ useMasterKey: true });
1412
}
1513
};

spec/ParseAPI.spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,25 @@ describe('miscellaneous', function () {
12671267
});
12681268
});
12691269

1270+
it('test cloud function query parameters with array of pointers', async () => {
1271+
Parse.Cloud.define('echoParams', req => {
1272+
return req.params;
1273+
});
1274+
const headers = {
1275+
'Content-Type': 'application/json',
1276+
'X-Parse-Application-Id': 'test',
1277+
'X-Parse-Javascript-Key': 'test',
1278+
};
1279+
const response = await request({
1280+
method: 'POST',
1281+
headers: headers,
1282+
url: 'http://localhost:8378/1/functions/echoParams',
1283+
body: '{"arr": [{ "__type": "Pointer", "className": "PointerTest" }]}',
1284+
});
1285+
const res = response.data.result;
1286+
expect(res.arr.length).toEqual(1);
1287+
});
1288+
12701289
it('can handle null params in cloud functions (regression test for #1742)', done => {
12711290
Parse.Cloud.define('func', request => {
12721291
expect(request.params.nullParam).toEqual(null);

spec/ParseHooks.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ describe('Hooks', () => {
190190

191191
it('should fail trying to create two times the same function', done => {
192192
Parse.Hooks.createFunction('my_new_function', 'http://url.com')
193-
.then(() => new Promise(resolve => setTimeout(resolve, 100)))
193+
.then(() => jasmine.timeout())
194194
.then(
195195
() => {
196196
return Parse.Hooks.createFunction('my_new_function', 'http://url.com');

spec/ParseUser.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3067,6 +3067,7 @@ describe('Parse.User testing', () => {
30673067
},
30683068
});
30693069
})
3070+
.then(() => jasmine.timeout())
30703071
.then(() => {
30713072
expect(emailCalled).toBe(true);
30723073
expect(emailOptions).not.toBeUndefined();

spec/PushController.spec.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ const successfulIOS = function (body, installations) {
2626
return Promise.all(promises);
2727
};
2828

29-
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
30-
3129
const pushCompleted = async pushId => {
3230
const query = new Parse.Query('_PushStatus');
3331
query.equalTo('objectId', pushId);
3432
let result = await query.first({ useMasterKey: true });
3533
while (!(result && result.get('status') === 'succeeded')) {
36-
await sleep(100);
34+
await jasmine.timeout();
3735
result = await query.first({ useMasterKey: true });
3836
}
3937
};
@@ -562,7 +560,7 @@ describe('PushController', () => {
562560
});
563561
const pushStatusId = await sendPush(payload, {}, config, auth);
564562
// it is enqueued so it can take time
565-
await sleep(1000);
563+
await jasmine.timeout(1000);
566564
Parse.serverURL = 'http://localhost:8378/1'; // GOOD url
567565
const result = await Parse.Push.getPushStatus(pushStatusId);
568566
expect(result).toBeDefined();
@@ -801,7 +799,7 @@ describe('PushController', () => {
801799
});
802800
await Parse.Object.saveAll(installations);
803801
await pushController.sendPush(payload, {}, config, auth);
804-
await sleep(1000);
802+
await jasmine.timeout(1000);
805803
const query = new Parse.Query('_PushStatus');
806804
const results = await query.find({ useMasterKey: true });
807805
expect(results.length).toBe(1);
@@ -856,7 +854,7 @@ describe('PushController', () => {
856854
const config = Config.get(Parse.applicationId);
857855
await Parse.Object.saveAll(installations);
858856
await pushController.sendPush(payload, {}, config, auth);
859-
await sleep(1000);
857+
await jasmine.timeout(1000);
860858
const query = new Parse.Query('_PushStatus');
861859
const results = await query.find({ useMasterKey: true });
862860
expect(results.length).toBe(1);

0 commit comments

Comments
 (0)