Skip to content

Fix ResendMailing angularJS (expected one mailing, could not find valid email)

bgm requested to merge bgm/resendmailing:fixAngular into main

In CiviCRM 5.55 (we were previously on 5.49), we started seeing odd issues, where using the Resend Mailing feature threw one of these errors:

  • Failed to find a suitable email for Contact
  • Expected to find one Mailing record, but there were zero

The second error was thrown by code in !5 (closed), but it wasn't the root of the issue.

The root was that AngularJS was sending the entire object instead of just the ID, and changing the ng-options (in this MR) fixes the bug.

I have to admit that I'm not sure why this bug would surface here, and if we're the only ones who ran into it. @larssg, is this a feature that you use?

Also I did cheat a bit in the MR, and added the date in the list of mailings, because it's difficult otherwise to find the mailing. I know it does not respect the locale/date-format, but it is ISO-8601-1 (and not the same format as in !7 (merged)), but it's a quickfix and helps a ton (I considered removing the time, but this particular clients sends a lot of targeted mailings, having the time-of-day helps).

image

Merge request reports