From 50f87f373ebf2ed1f777eec88ea7f7dfa47766b1 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Wed, 16 Dec 2020 15:11:53 +0530 Subject: [PATCH] fix: Use empty object if additional_attribute is null (#1520) --- .../dashboard/conversation/ContactPanel.vue | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue b/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue index 50662ad9b..32d703a1e 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue @@ -112,20 +112,19 @@ export default { return `${this.browser.browser_name || ''} ${this.browser .browser_version || ''}`; }, + contactAdditionalAttributes() { + return this.contact.additional_attributes || {}; + }, ipAddress() { - const { - additional_attributes: { created_at_ip: createdAtIp }, - } = this.contact; + const { created_at_ip: createdAtIp } = this.contactAdditionalAttributes; return createdAtIp; }, location() { const { - additional_attributes: { - country = '', - city = '', - country_code: countryCode, - }, - } = this.contact; + country = '', + city = '', + country_code: countryCode, + } = this.contactAdditionalAttributes; const cityAndCountry = [city, country].filter(item => !!item).join(', '); if (!cityAndCountry) {