From 5ce1e5e4631aa76e7909e41c52fc515756e59ecd Mon Sep 17 00:00:00 2001 From: Daniel Ordonez Date: Mon, 26 Jun 2023 18:26:52 -0500 Subject: [PATCH 1/6] fix(reportutils): Support personalDetails name in getIcon default result --- src/libs/OptionsListUtils.js | 2 +- src/libs/ReportUtils.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index a8edd8636202..54dbca236f31 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -516,7 +516,7 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, { result.text = reportName; result.searchText = getSearchText(report, reportName, personalDetailList, result.isChatRoom || result.isPolicyExpenseChat, result.isThread); - result.icons = ReportUtils.getIcons(report, personalDetails, UserUtils.getAvatar(personalDetail.avatar, personalDetail.accountID)); + result.icons = ReportUtils.getIcons(report, personalDetails, UserUtils.getAvatar(personalDetail.avatar, personalDetail.login), false, personalDetail.login); result.subtitle = subtitle; return result; diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 64a07113cb51..3d257886fddc 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -713,7 +713,7 @@ function getIconsForParticipants(participants, personalDetails) { * @param {Boolean} [isPayer] * @returns {Array<*>} */ -function getIcons(report, personalDetails, defaultIcon = null, isPayer = false) { +function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, defaultName = '') { const result = { source: '', type: CONST.ICON_TYPE_AVATAR, @@ -722,6 +722,7 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false) if (_.isEmpty(report)) { result.source = defaultIcon || Expensicons.FallbackAvatar; + result.name = defaultName || ''; return [result]; } if (isArchivedRoom(report)) { From e7113a5a653e9b1b6d54d18ba2b5e6e4c35368a7 Mon Sep 17 00:00:00 2001 From: Daniel Ordonez Date: Tue, 27 Jun 2023 10:42:38 -0500 Subject: [PATCH 2/6] fix(reportutils): Calculate default avatar with accountid for consistency with fallbackUserDetails --- src/libs/OptionsListUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 54dbca236f31..55e3058dd2b5 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -517,6 +517,7 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, { result.text = reportName; result.searchText = getSearchText(report, reportName, personalDetailList, result.isChatRoom || result.isPolicyExpenseChat, result.isThread); result.icons = ReportUtils.getIcons(report, personalDetails, UserUtils.getAvatar(personalDetail.avatar, personalDetail.login), false, personalDetail.login); + result.icons = ReportUtils.getIcons(report, personalDetails, UserUtils.getAvatar(personalDetail.avatar, personalDetail.accountID), false, personalDetail.login); result.subtitle = subtitle; return result; From e087f79db05e6a04ddcdb03240a0328db53be198 Mon Sep 17 00:00:00 2001 From: Daniel Ordonez Date: Tue, 27 Jun 2023 11:06:21 -0500 Subject: [PATCH 3/6] fix(reportutils): Remove first getIcon --- src/libs/OptionsListUtils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 55e3058dd2b5..bc4fd2539799 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -516,7 +516,6 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, { result.text = reportName; result.searchText = getSearchText(report, reportName, personalDetailList, result.isChatRoom || result.isPolicyExpenseChat, result.isThread); - result.icons = ReportUtils.getIcons(report, personalDetails, UserUtils.getAvatar(personalDetail.avatar, personalDetail.login), false, personalDetail.login); result.icons = ReportUtils.getIcons(report, personalDetails, UserUtils.getAvatar(personalDetail.avatar, personalDetail.accountID), false, personalDetail.login); result.subtitle = subtitle; From cdfc707903b9f63610fc1400a2a0c060133bfeaa Mon Sep 17 00:00:00 2001 From: Daniel Ordonez Date: Tue, 27 Jun 2023 11:15:37 -0500 Subject: [PATCH 4/6] fix(reportutils): Include JSDoc for new defaultName param --- src/libs/ReportUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 3d257886fddc..1704018c3cab 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -711,6 +711,7 @@ function getIconsForParticipants(participants, personalDetails) { * @param {Object} personalDetails * @param {*} [defaultIcon] * @param {Boolean} [isPayer] + * @param {String} [defaultName] * @returns {Array<*>} */ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, defaultName = '') { From 619394df4bf5538cc0fc8d53c97db8bb2e5a18ea Mon Sep 17 00:00:00 2001 From: Daniel Ordonez Date: Wed, 28 Jun 2023 16:07:25 -0500 Subject: [PATCH 5/6] fix(searchtooltip): Support login to accountid migration PR21026 --- src/components/MultipleAvatars.js | 2 +- src/libs/OptionsListUtils.js | 2 +- src/libs/ReportUtils.js | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/MultipleAvatars.js b/src/components/MultipleAvatars.js index 46535a259210..c62fc387b815 100644 --- a/src/components/MultipleAvatars.js +++ b/src/components/MultipleAvatars.js @@ -80,7 +80,7 @@ function MultipleAvatars(props) { } */ -function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, defaultName = '') { +function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, defaultName = '', defaultID = undefined) { const result = { source: '', type: CONST.ICON_TYPE_AVATAR, @@ -724,6 +725,7 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, if (_.isEmpty(report)) { result.source = defaultIcon || Expensicons.FallbackAvatar; result.name = defaultName || ''; + result.id = defaultID; return [result]; } if (isArchivedRoom(report)) { From 438a95fa0deb50d4971d3f9048a357fbd009b73b Mon Sep 17 00:00:00 2001 From: Daniel Ordonez Date: Thu, 29 Jun 2023 11:37:25 -0500 Subject: [PATCH 6/6] fix(searchtooltip): Update variable name --- src/libs/ReportUtils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index e04727214b2a..9d0571703172 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -712,10 +712,10 @@ function getIconsForParticipants(participants, personalDetails) { * @param {*} [defaultIcon] * @param {Boolean} [isPayer] * @param {String} [defaultName] - * @param {Number} [defaultID] + * @param {Number} [defaultAccountID] * @returns {Array<*>} */ -function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, defaultName = '', defaultID = undefined) { +function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, defaultName = '', defaultAccountID = undefined) { const result = { source: '', type: CONST.ICON_TYPE_AVATAR, @@ -725,7 +725,7 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, if (_.isEmpty(report)) { result.source = defaultIcon || Expensicons.FallbackAvatar; result.name = defaultName || ''; - result.id = defaultID; + result.id = defaultAccountID; return [result]; } if (isArchivedRoom(report)) {