Add check to avoid cicular template reference

This commit is contained in:
Rune Hem Strand
2018-03-02 17:49:02 +01:00
parent 4bc9d96bce
commit 20216df8cf

View File

@@ -516,9 +516,13 @@
var availableMasterTemplates = [];
// filter out the current template and the selected master template
angular.forEach(vm.templates, function(template){
if(template.alias !== vm.template.alias && template.alias !== vm.template.masterTemplateAlias) {
availableMasterTemplates.push(template);
angular.forEach(vm.templates, function (template) {
if (template.alias !== vm.template.alias && template.alias !== vm.template.masterTemplateAlias) {
var templatePathArray = template.path.split(',');
// filter descendant templates of current template
if (templatePathArray.indexOf(String(vm.template.id)) === -1) {
availableMasterTemplates.push(template);
}
}
});