From 1de18391b4545566b03078e4f32c77ba926b6848 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Mon, 28 Feb 2022 19:48:13 +0530 Subject: [PATCH] fix: Handle invalid country code in contact details (#4081) --- .../dashboard/conversation/contact/ContactInfo.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfo.vue b/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfo.vue index 4a58d8a54..90aeb43ee 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfo.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfo.vue @@ -210,8 +210,7 @@ export default { if (!cityAndCountry) { return ''; } - const countryFlag = countryCode ? flag(countryCode) : '🌎'; - return `${cityAndCountry} ${countryFlag}`; + return this.findCountryFlag(countryCode, cityAndCountry); }, socialProfiles() { const { @@ -261,6 +260,14 @@ export default { this.showConversationModal = false; this.showEditModal = false; }, + findCountryFlag(countryCode, cityAndCountry) { + try { + const countryFlag = countryCode ? flag(countryCode) : '🌎'; + return `${cityAndCountry} ${countryFlag}`; + } catch (error) { + return ''; + } + }, async deleteContact({ id }) { try { await this.$store.dispatch('contacts/delete', id);