From b252aeb29b4fd88e806b1499e372b724c8f3e3a1 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 11 Feb 2022 10:03:26 -0500 Subject: [PATCH] fix(mail(js)): expect the recipient to become a string when saving a message --- .../js/Mailer/Message.service.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/UI/WebServerResources/js/Mailer/Message.service.js b/UI/WebServerResources/js/Mailer/Message.service.js index 717a29622a..cf02869b12 100644 --- a/UI/WebServerResources/js/Mailer/Message.service.js +++ b/UI/WebServerResources/js/Mailer/Message.service.js @@ -275,8 +275,22 @@ */ Message.prototype.$shortAddress = function(type) { var address = ''; - if (this[type] && this[type].length > 0) { - address = this[type][0].name || this[type][0].email || ''; + if (this[type]) { + if (angular.isString(this[type])) { + // The recipient is a string; try to extract the name + var emailRE = / 0) { + // We have an array of objects; pick the first one + address = this[type][0].name || this[type][0].email || ''; + } } return address;