Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.29, 4.7.30
-
Fix Version/s: 5.0.0
-
Component/s: CiviMail
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Needs Funding
-
Verified?:No
-
Overview:Recipients are not shown when adding groups to a mailing.
-
How it works currently:When adding recipients to a mailing the number of recipients updates to the right of the field but the field itself remains blank.
-
How it should work:The names of recipients should be show, along with an x to remove them from the list.
-
Acceptance Criteria:Rewrite the loop (https://github.com/civicrm/civicrm-core/blob/master/ang/crmMailing/Recipients.js#L139) to use the correct iteration method, as described.
Description
Recipients.js iterates over an array in an incorrect fashion, see here: https://github.com/civicrm/civicrm-core/blob/master/ang/crmMailing/Recipients.js#L139
It is using the for-in method of iteration, causing it to treat the array as an object and iterate over all the contents, including other items that might be added to the array's prototype. This isn't an issue in normal usage, however, MooTools, used by Joomla 3.8.5 adds a function the the Array prototype. The loop passes each value in the array to convertValueToObj() which then tries to call .split(), which fails when the function is reached.
Visually, this causes selected groups to not show up in the recipients field of the mailing editor. Functionally, this causes uncertainty as to which groups are selected and also inhibits deleting groups from the list.
This issue is resolved by using a traditional method of iterating the array:
for (var i = 0; i < values.length; i++) {