Fixed TypeError caused by #1904.

"Resource.relationList is undefinded" after activating a slide.
This commit is contained in:
Emanuel Schuetze 2016-01-27 23:30:41 +01:00
parent c4281c6bc7
commit 587f397171

View File

@ -149,13 +149,15 @@ angular.module('OpenSlidesApp.core', [
function (DS) {
return function (collection, instance) {
var Resource = DS.definitions[collection];
Resource.relationList.forEach(function (relationDef) {
if (relationDef.foreignKey) {
var query = {};
query[relationDef.foreignKey] = instance[Resource.idAttribute];
Resource.getResource(relationDef.relation).ejectAll(query);
}
});
if (Resource.relationList) {
Resource.relationList.forEach(function (relationDef) {
if (relationDef.foreignKey) {
var query = {};
query[relationDef.foreignKey] = instance[Resource.idAttribute];
Resource.getResource(relationDef.relation).ejectAll(query);
}
});
}
}
}
])