From bbf63001da935427a4488fce43a67f516422cd21 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Sun, 16 Oct 2022 21:55:59 +0300 Subject: [PATCH] Return null if the provided argument is empty --- assets/js/utils/calendar_event_popover.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/assets/js/utils/calendar_event_popover.js b/assets/js/utils/calendar_event_popover.js index 625b9749..1ed12e6e 100644 --- a/assets/js/utils/calendar_event_popover.js +++ b/assets/js/utils/calendar_event_popover.js @@ -22,7 +22,7 @@ App.Utils.CalendarEventPopover = (function () { * * @param {Object} user Should have the address, city, etc properties. * - * @return {string} The rendered HTML. + * @return {String} The rendered HTML. */ function renderMapIcon(user) { const data = []; @@ -44,7 +44,7 @@ App.Utils.CalendarEventPopover = (function () { } if (!data.length) { - return ''; + return null; } return $('
', { @@ -69,9 +69,13 @@ App.Utils.CalendarEventPopover = (function () { * * @param {String} email * - * @return {string} The rendered HTML. + * @return {String} The rendered HTML. */ function renderMailIcon(email) { + if (!email) { + return null; + } + return $('
', { 'html': [ $('', { @@ -94,9 +98,13 @@ App.Utils.CalendarEventPopover = (function () { * * @param {String} phone * - * @return {string} The rendered HTML. + * @return {String} The rendered HTML. */ function renderPhoneIcon(phone) { + if (!phone) { + return null; + } + return $('
', { 'html': [ $('', {