From 5543e896233a39f6c169e24a6c94250f1f5233d6 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 23 Aug 2021 14:43:18 -0400 Subject: [PATCH] Afform - fix contact source field Contact source is supposed to take its default from the afform title This fixes it to initialize with the title and keep in sync. --- ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js b/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js index 13a4bbe5ad..275b2827e6 100644 --- a/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js +++ b/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js @@ -120,7 +120,7 @@ while (!!$scope.entities[type + num]) { num++; } - $scope.entities[type + num] = backfillEntityDefaults(_.assign($parse(meta.defaults)($scope), { + $scope.entities[type + num] = backfillEntityDefaults(_.assign($parse(meta.defaults)(editor), { '#tag': 'af-entity', type: meta.entity, name: type + num, @@ -331,7 +331,7 @@ $scope.$watch('editor.afform.title', function(newTitle, oldTitle) { if (typeof oldTitle === 'string') { _.each($scope.entities, function(entity) { - if (entity.data && entity.data.source === oldTitle) { + if (entity.data && 'source' in entity.data && (entity.data.source || '') === oldTitle) { entity.data.source = newTitle; } }); -- 2.25.1