CRM-21780 Recipients are not shown when creating / editing mailings

    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++) {

        Attachments

          Activity

          [CRM-21780] Recipients are not shown when creating / editing mailings
          John Birchall added a comment -

          I can see up to a maximum of 10 groups in the select box, after which no additional groups appear to be selected, though they are.

          Eileen McNaughton added a comment -

          5.0 is due out today & likely fixes this - can you test?

          John Birchall added a comment -

          On the basis of in-browser manual testing I conform that the issue has been cleared up in CiviCRM 5.0.0.

          Eileen McNaughton added a comment -

          Thanks for confirming!

          Phil Morice Brubaker added a comment - - edited

          I am still seeing the incorrect behavior in Joomla 3.8.12, Civi 5.5.1. 

          The code that is in the Description as resolving the problem is not in Recipients.js

          Eileen McNaughton added a comment -

          It's probably worth creating a ticket on gitlab with steps to reproduce.

           

          Coleman Watts - this seems to be a simple proposal to change a line in js

           

          https://github.com/civicrm/civicrm-core/blob/master/ang/crmMailing/Recipients.js#L139

          to
          for (var i = 0; i < values.length; i++) {

          to avoid some sort of incompatibility

           

          Phil Morice Brubaker added a comment -

          Created new issue in Gitlab: https://lab.civicrm.org/dev/joomla/issues/3

            People

            • Assignee:
              Unassigned
              Reporter:
              Luke Baker

              Dates

              • Created:
                Updated:
                Resolved: