Compare commits

...
11 Commits
Author SHA1 Message Date
Fosco Marotto b2819df7e5 Merge pull request #1264 from ParsePlatform/fosco.224
Changelog and update to 2.2.4
2016-03-29 14:36:26 -08:00
Fosco Marotto 5dc5ef239e Merge pull request #1265 from drew-gross/ignore-thrown-message
Fix test issue cause by env variables
2016-03-29 14:36:07 -08:00
Fosco Marotto f25bcc490a Updated changelog 2016-03-29 15:31:36 -07:00
Florent Vilmart aa5ebd49f0 Merge pull request #1199 from yuzeh/fix-authData-null-value
Clean authData of null values on _User update
2016-03-29 18:28:17 -04:00
Fosco Marotto 106ac95622 Fix adapter imports 2016-03-29 15:27:43 -07:00
Fosco Marotto 1f4393cd4d Changelog and update to 2.2.4 2016-03-29 15:10:55 -07:00
Fosco Marotto e361ccf5a5 Merge pull request #1263 from drew-gross/fix-adapters
Fix adapter imports
2016-03-29 14:08:46 -08:00
Drew Gross 342a3a92fe Fix adapter imports 2016-03-29 15:05:03 -07:00
Dan Huang 507fa54570 Merge branch 'master' into fix-authData-null-value 2016-03-29 14:43:19 -07:00
yuzeh 1b8e613dfb Clean authData of null values on _User update
Adds a step to the RestWrite#execute chain: it cleans the response
authData object of null values.

For example, this:

{"authData": {"anonymous": null}, "updatedAt", ...}

will be transformed to this:

{"updatedAt", ...}

And this:

{"authData": {"anonymous": null, "twitter": ...}, "updatedAt", ...}

will be transformed to this:

{"authData": {"twitter": ...}, "updatedAt", ...}

Fixing this issue will fix anonymous user upgrades from the Android SDK.
2016-03-29 14:42:37 -07:00
Florent Vilmart f259a3b17e Supports increment as well as Increment 2016-03-29 14:42:37 -07:00
6 changed files with 95 additions and 6 deletions
+5
View File
@@ -1,5 +1,10 @@
## Parse Server Changelog
### 2.2.4 (3/29/2016)
* Hotfix: fixed imports issue for S3Adapter, GCSAdapter, FileSystemAdapter [\#1263](https://github.com/ParsePlatform/parse-server/pull/1263) ([drew-gross](https://github.com/drew-gross)
* Fix: Clean null authData values on _User update [\#1199](https://github.com/ParsePlatform/parse-server/pull/1199) ([yuzeh](https://github.com/yuzeh))
### 2.2.3 (3/29/2016)
* Fixed bug with invalid email verification link on email update. [\#1253](https://github.com/ParsePlatform/parse-server/pull/1253) ([kzielonka](https://github.com/kzielonka))
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "parse-server",
"version": "2.2.3",
"version": "2.2.4",
"description": "An express module providing a Parse-compatible API server",
"main": "lib/index.js",
"repository": {
+59
View File
@@ -2061,6 +2061,65 @@ describe('Parse.User testing', () => {
})
});
// https://github.com/ParsePlatform/parse-server/issues/1198
it('should cleanup null authData keys ParseUser update', (done) => {
Parse.Cloud.beforeSave('_User', (req, res) => {
req.object.set('foo', 'bar');
res.success();
});
// Simulate anonymous user save
new Promise((resolve, reject) => {
request.post({
url: 'http://localhost:8378/1/classes/_User',
headers: {
'X-Parse-Application-Id': Parse.applicationId,
'X-Parse-REST-API-Key': 'rest',
},
json: {authData: {anonymous: {id: '00000000-0000-0000-0000-000000000001'}}}
}, (err, res, body) => {
if (err) {
reject(err);
} else {
resolve(body);
}
});
}).then((user) => {
// Simulate registration
return new Promise((resolve, reject) => {
request.put({
url: 'http://localhost:8378/1/classes/_User/' + user.objectId,
headers: {
'X-Parse-Application-Id': Parse.applicationId,
'X-Parse-Session-Token': user.sessionToken,
'X-Parse-REST-API-Key': 'rest',
},
json: {
authData: {anonymous: null},
user: 'user',
password: 'password',
}
}, (err, res, body) => {
if (err) {
reject(err);
} else {
resolve(body);
}
});
});
}).then((user) => {
expect(typeof user).toEqual('object');
expect(user.authData).toBeUndefined();
Parse.Cloud._removeHook('Triggers', 'beforeSave', '_User');
done();
}).catch((err) => {
fail('no request should fail: ' + JSON.stringify(err));
Parse.Cloud._removeHook('Triggers', 'beforeSave', '_User');
done();
});
});
it('should aftersave with full object', (done) => {
var hit = 0;
Parse.Cloud.afterSave('_User', (req, res) => {
+7
View File
@@ -239,4 +239,11 @@ describe('server', () => {
expect(typeof ParseServer.default.createLiveQueryServer).toEqual('function');
done();
});
it('exposes all the "core" adapters', done => {
expect(ParseServer.S3Adapter).toThrow();
expect(ParseServer.GCSAdapter).toThrow('GCSAdapter requires an projectId');
expect(ParseServer.FileSystemAdapter).toThrow();
done();
});
});
+18
View File
@@ -83,6 +83,8 @@ RestWrite.prototype.execute = function() {
return this.handleFollowup();
}).then(() => {
return this.runAfterTrigger();
}).then(() => {
return this.cleanUserAuthData();
}).then(() => {
return this.response;
});
@@ -824,5 +826,21 @@ RestWrite.prototype.sanitizedData = function() {
return Parse._decode(undefined, data);
}
RestWrite.prototype.cleanUserAuthData = function() {
if (this.response && this.response.response && this.className === '_User') {
let user = this.response.response;
if (user.authData) {
Object.keys(user.authData).forEach((provider) => {
if (user.authData[provider] === null) {
delete user.authData[provider];
}
});
if (Object.keys(user.authData).length == 0) {
delete user.authData;
}
}
}
};
export default RestWrite;
module.exports = RestWrite;
+5 -5
View File
@@ -1,8 +1,8 @@
import winston from 'winston';
import ParseServer from './ParseServer';
import { GCSAdapter } from 'parse-server-gcs-adapter';
import { S3Adapter } from 'parse-server-s3-adapter';
import { FileSystemAdapter } from 'parse-server-fs-adapter';
import winston from 'winston';
import ParseServer from './ParseServer';
import GCSAdapter from 'parse-server-gcs-adapter';
import S3Adapter from 'parse-server-s3-adapter';
import FileSystemAdapter from 'parse-server-fs-adapter';
if (process.env.VERBOSE || process.env.VERBOSE_PARSE_SERVER) {
winston.level = 'silly';