From 0f148f77002d0ee7e09a22c4051dc0053beb6713 Mon Sep 17 00:00:00 2001 From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> Date: Fri, 13 Aug 2021 13:37:51 +0530 Subject: [PATCH] fix: Fixes parsing issue with custom attributes (#2796) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Fixes parsing issue with custom attributes * Update app/javascript/dashboard/routes/dashboard/conversation/ContactCustomAttributes.vue Co-authored-by: शैलेश कळमकर (Shailesh Kalamkar) Co-authored-by: Muhsin Keloth Co-authored-by: शैलेश कळमकर (Shailesh Kalamkar) Co-authored-by: Sojan Jose --- .../conversation/ContactCustomAttributes.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ContactCustomAttributes.vue b/app/javascript/dashboard/routes/dashboard/conversation/ContactCustomAttributes.vue index 7639e08e3..0e2cfa8cb 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ContactCustomAttributes.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ContactCustomAttributes.vue @@ -45,9 +45,20 @@ export default { }, methods: { valueWithLink(attribute) { - const messageFormatter = new MessageFormatter(attribute); + const parsedAttribute = this.parseAttributeToString(attribute); + const messageFormatter = new MessageFormatter(parsedAttribute); return messageFormatter.formattedMessage; }, + parseAttributeToString(attribute) { + switch (typeof attribute) { + case 'string': + return attribute; + case 'object': + return JSON.stringify(attribute); + default: + return `${attribute}`; + } + }, }, };