File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1511,5 +1511,20 @@ describe('schemas', () => {
1511
1511
fail ( 'should not fail' ) ;
1512
1512
done ( ) ;
1513
1513
} ) ;
1514
+ } ) ;
1515
+
1516
+ it ( 'can login when addFields is false (issue #1355)' , ( done ) => {
1517
+ setPermissionsOnClass ( '_User' , {
1518
+ 'addField' : { }
1519
+ } ) . then ( ( ) => {
1520
+ return Parse . User . signUp ( 'foo' , 'bar' ) ;
1521
+ } ) . then ( ( user ) => {
1522
+ expect ( user . getUsername ( ) ) . toBe ( 'foo' ) ;
1523
+ done ( )
1524
+ } , ( err ) => {
1525
+ console . error ( err ) ;
1526
+ fail ( 'should create user' ) ;
1527
+ done ( ) ;
1528
+ } )
1514
1529
} )
1515
1530
} ) ;
Original file line number Diff line number Diff line change @@ -263,6 +263,16 @@ class Schema {
263
263
}
264
264
} ) ;
265
265
if ( className ) {
266
+ // merge with the default schema
267
+ let defaultClassData = Object . assign ( { } , defaultColumns . _Default , defaultColumns [ className ] ) ;
268
+ defaultClassData = Object . keys ( defaultClassData ) . reduce ( ( memo , key ) => {
269
+ let type = schemaAPITypeToMongoFieldType ( defaultClassData [ key ] ) . result ;
270
+ if ( type ) {
271
+ memo [ key ] = type ;
272
+ }
273
+ return memo ;
274
+ } , { } ) ;
275
+ classData = Object . assign ( { } , defaultClassData , classData ) ;
266
276
this . data [ className ] = classData ;
267
277
if ( permsData ) {
268
278
this . perms [ className ] = permsData ;
You can’t perform that action at this time.
0 commit comments