Skip to content

Commit 3316ac9

Browse files
dplewisdavimacedo
authored andcommitted
Fix #992 (#1018)
After much discussion the proper way to subclass is a user is `Parse.Object.registerSubclass('_User', CustomUser);` Revert ##978
1 parent 028273b commit 3316ac9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

integration/test/ParseUserTest.js

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ describe('Parse User', () => {
4949
Parse.initialize('integration', null, 'notsosecret');
5050
Parse.CoreManager.set('SERVER_URL', 'http://localhost:1337/parse');
5151
Parse.Storage._clear();
52+
Parse.Object.registerSubclass('_User', Parse.User);
5253
});
5354

5455
beforeEach((done) => {
@@ -632,6 +633,7 @@ describe('Parse User', () => {
632633

633634
it('can get current with subclass', async () => {
634635
Parse.User.enableUnsafeCurrentUser();
636+
Parse.Object.registerSubclass('_User', CustomUser);
635637

636638
const customUser = new CustomUser({ foo: 'bar' });
637639
customUser.setUsername('username');

src/ParseUser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ const DefaultController = {
871871
const json = user.toJSON();
872872
delete json.password;
873873

874-
json.className = user.constructor.name === ParseUser.name ? '_User' : user.constructor.name;
874+
json.className = '_User';
875875
return Storage.setItemAsync(
876876
path, JSON.stringify(json)
877877
).then(() => {

0 commit comments

Comments
 (0)