Skip to content

Commit bf47a0b

Browse files
committed
Remove acceptor parameter (#1553)
1 parent 3945e0c commit bf47a0b

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

src/Controllers/DatabaseController.js

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,15 @@ DatabaseController.prototype.validateClassName = function(className) {
5858
// Returns a promise for a schema object.
5959
// If we are provided a acceptor, then we run it on the schema.
6060
// If the schema isn't accepted, we reload it at most once.
61-
DatabaseController.prototype.loadSchema = function(acceptor = () => true) {
61+
DatabaseController.prototype.loadSchema = function() {
6262

6363
if (!this.schemaPromise) {
6464
this.schemaPromise = this.schemaCollection().then(collection => {
6565
delete this.schemaPromise;
6666
return SchemaController.load(collection, this.adapter);
6767
});
68-
return this.schemaPromise;
6968
}
70-
71-
return this.schemaPromise.then((schema) => {
72-
if (acceptor(schema)) {
73-
return schema;
74-
}
75-
this.schemaPromise = this.schemaCollection().then(collection => {
76-
delete this.schemaPromise;
77-
return SchemaController.load(collection, this.adapter);
78-
});
79-
return this.schemaPromise;
80-
});
69+
return this.schemaPromise;
8170
};
8271

8372
// Returns a promise for the classname that is related to the given
@@ -147,13 +136,10 @@ DatabaseController.prototype.update = function(className, query, update, options
147136
// Make a copy of the object, so we don't mutate the incoming data.
148137
update = deepcopy(update);
149138

150-
var acceptor = function(schema) {
151-
return schema.hasKeys(className, Object.keys(query));
152-
};
153139
var isMaster = !('acl' in options);
154140
var aclGroup = options.acl || [];
155141
var mongoUpdate, schema;
156-
return this.loadSchema(acceptor)
142+
return this.loadSchema()
157143
.then(s => {
158144
schema = s;
159145
if (!isMaster) {
@@ -586,9 +572,8 @@ DatabaseController.prototype.find = function(className, query, options = {}) {
586572
}
587573
let isMaster = !('acl' in options);
588574
let aclGroup = options.acl || [];
589-
let acceptor = schema => schema.hasKeys(className, keysForQuery(query))
590575
let schema = null;
591-
return this.loadSchema(acceptor).then(s => {
576+
return this.loadSchema().then(s => {
592577
schema = s;
593578
if (options.sort) {
594579
mongoOptions.sort = {};

0 commit comments

Comments
 (0)