Skip to content

Commit

Permalink
Fix #992
Browse files Browse the repository at this point in the history
After much discussion the proper way to subclass is a user is `Parse.Object.registerSubclass('_User', CustomUser);`

Revert ##978
  • Loading branch information
dplewis committed Dec 2, 2019
1 parent 028273b commit 3a2526c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions integration/test/ParseUserTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('Parse User', () => {
Parse.initialize('integration', null, 'notsosecret');
Parse.CoreManager.set('SERVER_URL', 'http://localhost:1337/parse');
Parse.Storage._clear();
Parse.Object.registerSubclass('_User', Parse.User);
});

beforeEach((done) => {
Expand Down Expand Up @@ -632,6 +633,7 @@ describe('Parse User', () => {

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

const customUser = new CustomUser({ foo: 'bar' });
customUser.setUsername('username');
Expand Down
2 changes: 1 addition & 1 deletion src/ParseUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ const DefaultController = {
const json = user.toJSON();
delete json.password;

json.className = user.constructor.name === ParseUser.name ? '_User' : user.constructor.name;
json.className = '_User';
return Storage.setItemAsync(
path, JSON.stringify(json)
).then(() => {
Expand Down

0 comments on commit 3a2526c

Please sign in to comment.