Skip to content

Commit 157e43f

Browse files
committed
Merge pull request #861 from ParsePlatform/fosco.role1
Fix for related query on non-existing column
2 parents 375e701 + 4ee9cb7 commit 157e43f

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

spec/ParseRole.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,5 +177,25 @@ describe('Parse Role testing', () => {
177177

178178
});
179179

180+
it('can create role and query empty users', (done)=> {
181+
var roleACL = new Parse.ACL();
182+
roleACL.setPublicReadAccess(true);
183+
var role = new Parse.Role('subscribers', roleACL);
184+
role.save({}, {useMasterKey : true})
185+
.then((x)=>{
186+
var query = role.relation('users').query();
187+
query.find({useMasterKey : true})
188+
.then((users)=>{
189+
done();
190+
}, (e)=>{
191+
fail('should not have errors');
192+
done();
193+
});
194+
}, (e) => {
195+
console.log(e);
196+
fail('should not have errored');
197+
});
198+
});
199+
180200
});
181201

src/Controllers/DatabaseController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ DatabaseController.prototype.loadSchema = function(acceptor = returnsTrue) {
8989
DatabaseController.prototype.redirectClassNameForKey = function(className, key) {
9090
return this.loadSchema().then((schema) => {
9191
var t = schema.getExpectedType(className, key);
92-
var match = t.match(/^relation<(.*)>$/);
92+
var match = t ? t.match(/^relation<(.*)>$/) : false;
9393
if (match) {
9494
return match[1];
9595
} else {

0 commit comments

Comments
 (0)