Fixes SchemaController data for Volatile Classes (#3171)

* Reproduction for the issue

* Ensures Volatile classes and other schema share the same structure
This commit is contained in:
Florent Vilmart
2016-12-06 16:42:54 -05:00
committed by GitHub
parent 8111c3338e
commit 2e569ca7dd
2 changed files with 40 additions and 6 deletions

View File

@@ -346,11 +346,9 @@ export default class SchemaController {
// Inject the in-memory classes
volatileClasses.forEach(className => {
this.data[className] = injectDefaultSchema({
className,
fields: {},
classLevelPermissions: {}
});
let schema = injectDefaultSchema({ className });
this.data[className] = schema.fields;
this.perms[className] = schema.classLevelPermissions;
});
delete this.reloadDataPromise;
}, (err) => {
@@ -388,7 +386,11 @@ export default class SchemaController {
}
return promise.then(() => {
if (allowVolatileClasses && volatileClasses.indexOf(className) > -1) {
return Promise.resolve(this.data[className]);
return Promise.resolve({
className,
fields: this.data[className],
classLevelPermissions: this.perms[className]
});
}
return this._cache.getOneSchema(className).then((cached) => {
if (cached && !options.clearCache) {