From 4b0fb6ef332cfeb591221830f00c3fee11d6383e Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Thu, 9 Nov 2017 07:09:53 +1100 Subject: [PATCH] CRM-21411 Fix issue where unsubscribe group field would not show because CRM.crmMailing.groupNames was empty --- ang/crmMailing/BlockMailing.html | 2 +- ang/crmMailing/EditUnsubGroupCtrl.js | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ang/crmMailing/BlockMailing.html b/ang/crmMailing/BlockMailing.html index 2e37083c1b..5a04d8e04f 100644 --- a/ang/crmMailing/BlockMailing.html +++ b/ang/crmMailing/BlockMailing.html @@ -61,7 +61,7 @@ It could perhaps be thinned by 30-60% by making more directives. ng-model="mailing.recipients.groups.base[0]" ng-required="true" > - + diff --git a/ang/crmMailing/EditUnsubGroupCtrl.js b/ang/crmMailing/EditUnsubGroupCtrl.js index c0e7d3e71f..56070e03e6 100644 --- a/ang/crmMailing/EditUnsubGroupCtrl.js +++ b/ang/crmMailing/EditUnsubGroupCtrl.js @@ -3,14 +3,16 @@ angular.module('crmMailing').controller('EditUnsubGroupCtrl', function EditUnsubGroupCtrl($scope) { // CRM.crmMailing.groupNames is a global constant - since it doesn't change, we can digest & cache. var mandatoryIds = []; - _.each(CRM.crmMailing.groupNames, function(grp) { - if (grp.is_hidden == "1") { - mandatoryIds.push(parseInt(grp.id)); - } - }); $scope.isUnsubGroupRequired = function isUnsubGroupRequired(mailing) { - return _.intersection(mandatoryIds, mailing.recipients.groups.include).length > 0; + if (!_.isEmpty(CRM.crmMailing.groupNames)) { + _.each(CRM.crmMailing.groupNames, function(grp) { + if (grp.is_hidden == "1") { + mandatoryIds.push(parseInt(grp.id)); + } + }); + return _.intersection(mandatoryIds, mailing.recipients.groups.include).length > 0; + } }; }); -- 2.25.1