We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 58a2ee3 commit 364604eCopy full SHA for 364604e
spec/CloudCode.spec.js
@@ -954,7 +954,11 @@ it('beforeSave should not affect fetched pointers', done => {
954
});
955
956
957
- it('should fully delete objects when using `unset` with beforeSave (regression test for #1840)', done => {
+ /*
958
+ TODO: fix for Postgres
959
+ trying to delete a field that doesn't exists doesn't play nice
960
+ */
961
+ it_exclude_dbs(['postgres'])('should fully delete objects when using `unset` with beforeSave (regression test for #1840)', done => {
962
var TestObject = Parse.Object.extend('TestObject');
963
var BeforeSaveObject = Parse.Object.extend('BeforeSaveChanged');
964
spec/ParseAPI.spec.js
@@ -1494,6 +1494,42 @@ it('ensure that if you try to sign up a user with a unique username and email, b
1494
done();
1495
1496
1497
+
1498
+ it('should not update schema beforeSave #2672', (done) => {
1499
+ Parse.Cloud.beforeSave('MyObject', (request, response) => {
1500
+ if (request.object.get('secret')) {
1501
+ response.error('cannot set secret here');
1502
+ return;
1503
+ }
1504
+ response.success();
1505
+ });
1506
1507
+ let object = new Parse.Object('MyObject');
1508
+ object.set('key', 'value');
1509
+ object.save().then(() => {
1510
+ return object.save({'secret': 'should not update schema'});
1511
+ }).then(() => {
1512
+ fail();
1513
+ done();
1514
+ }, () => {
1515
+ return rp({
1516
+ method: 'GET',
1517
+ headers: {
1518
+ 'X-Parse-Application-Id': 'test',
1519
+ 'X-Parse-Master-Key': 'test'
1520
+ },
1521
+ uri: 'http://localhost:8378/1/schemas/MyObject',
1522
+ json: true
1523
1524
+ }).then((res) => {
1525
+ let fields = res.fields;
1526
+ expect(fields.secret).toBeUndefined();
1527
1528
+ }, (err) => {
1529
+ jfail(err);
1530
1531
1532
1533
1534
1535
describe_only_db('mongo')('legacy _acl', () => {
spec/schemas.spec.js
@@ -96,7 +96,8 @@ const userSchema = {
96
"username": {"type": "String"},
97
"password": {"type": "String"},
98
"email": {"type": "String"},
99
- "emailVerified": {"type": "Boolean"}
+ "emailVerified": {"type": "Boolean"},
100
+ "authData": {"type": "Object"}
101
},
102
"classLevelPermissions": defaultClassLevelPermissions,
103
}
@@ -676,6 +677,7 @@ describe('schemas', () => {
676
677
password: {type: 'String'},
678
email: {type: 'String'},
679
emailVerified: {type: 'Boolean'},
680
+ authData: {type: 'Object'},
681
newField: {type: 'String'},
682
ACL: {type: 'ACL'}
683
@@ -696,6 +698,7 @@ describe('schemas', () => {
696
698
697
699
700
701
702
703
704
src/Controllers/SchemaController.js
@@ -31,6 +31,7 @@ const defaultColumns = Object.freeze({
31
"password": {type:'String'},
32
"email": {type:'String'},
33
"emailVerified": {type:'Boolean'},
34
+ "authData": {type:'Object'}
35
36
// The additional default columns for the _Installation collection (in addition to DefaultCols)
37
_Installation: {
src/RestWrite.js
@@ -62,8 +62,6 @@ RestWrite.prototype.execute = function() {
62
return this.getUserAndRoleACL();
63
}).then(() => {
64
return this.validateClientClassCreation();
65
- }).then(() => {
66
- return this.validateSchema();
67
68
return this.handleInstallation();
69
@@ -72,6 +70,8 @@ RestWrite.prototype.execute = function() {
72
70
return this.validateAuthData();
73
71
74
return this.runBeforeTrigger();
+ return this.validateSchema();
75
76
return this.setRequiredFieldsIfNeeded();
77
@@ -176,7 +176,6 @@ RestWrite.prototype.runBeforeTrigger = function() {
176
if (this.query && this.query.objectId) {
177
delete this.data.objectId
178
179
180
181
182
};
0 commit comments