From 9af9c9650c3700050a4a4fd51bfa77cf23a2b74a Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Tue, 20 Jun 2023 13:53:08 -0700 Subject: [PATCH 1/5] only consider personal details with logins set --- src/libs/OptionsListUtils.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index e9e4a2f636a3..35624e6f0fd8 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -544,13 +544,18 @@ function isSearchStringMatch(searchValue, searchText, participantNames = new Set * yourself or a different user, and people won't be starting new chats via accountID usually. * * @param {Object} userDetails + * @param {Boolean} [useAccountID] Should we make the comparison using accountIDs? * @returns {Boolean} */ -function isCurrentUser(userDetails) { +function isCurrentUser(userDetails, useAccountID) { if (!userDetails) { return false; } + if (useAccountID) { + return userDetails.accountID === currentUserAccountID; + } + // If user login is a mobile number, append sms domain if not appended already. const userDetailsLogin = addSMSDomainIfPhoneNumber(userDetails.login); @@ -603,6 +608,12 @@ function getOptions( }; } + // We're only picking personal details that have logins set + // This is a temporary fix for all the logic that's been breaking because of the new privacy changes + // See for more context + // eslint-disable-next-line no-param-reassign + personalDetails = _.pick(personalDetails, detail => Boolean(detail.login)); + let recentReportOptions = []; let personalDetailsOptions = []; const reportMapForAccountIDs = {}; From 6d3cea120820070ce415eca227580b0d1e342499 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Tue, 20 Jun 2023 13:54:36 -0700 Subject: [PATCH 2/5] style --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 35624e6f0fd8..828b3e7c9184 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -612,7 +612,7 @@ function getOptions( // This is a temporary fix for all the logic that's been breaking because of the new privacy changes // See for more context // eslint-disable-next-line no-param-reassign - personalDetails = _.pick(personalDetails, detail => Boolean(detail.login)); + personalDetails = _.pick(personalDetails, (detail) => Boolean(detail.login)); let recentReportOptions = []; let personalDetailsOptions = []; From fc0916ae881b4500274129efdbd3515acab59186 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Tue, 20 Jun 2023 13:55:15 -0700 Subject: [PATCH 3/5] remove unused --- src/libs/OptionsListUtils.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 828b3e7c9184..81de999451f7 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -544,18 +544,13 @@ function isSearchStringMatch(searchValue, searchText, participantNames = new Set * yourself or a different user, and people won't be starting new chats via accountID usually. * * @param {Object} userDetails - * @param {Boolean} [useAccountID] Should we make the comparison using accountIDs? * @returns {Boolean} */ -function isCurrentUser(userDetails, useAccountID) { +function isCurrentUser(userDetails) { if (!userDetails) { return false; } - if (useAccountID) { - return userDetails.accountID === currentUserAccountID; - } - // If user login is a mobile number, append sms domain if not appended already. const userDetailsLogin = addSMSDomainIfPhoneNumber(userDetails.login); From 1fcc839f97345f19f41d99d64ec6e9e87f9e8ca7 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Tue, 20 Jun 2023 13:55:40 -0700 Subject: [PATCH 4/5] add issue link --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 81de999451f7..af2309c3eda8 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -605,7 +605,7 @@ function getOptions( // We're only picking personal details that have logins set // This is a temporary fix for all the logic that's been breaking because of the new privacy changes - // See for more context + // See https://github.com/Expensify/Expensify/issues/293465 for more context // eslint-disable-next-line no-param-reassign personalDetails = _.pick(personalDetails, (detail) => Boolean(detail.login)); From 116abf58876038cb102d94477c95ebb504a93c96 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Tue, 20 Jun 2023 16:02:31 -0700 Subject: [PATCH 5/5] fix error with description being unset --- src/libs/actions/Task.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index c31f1617349d..5e27d7db764d 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -305,7 +305,9 @@ function editTaskAndNavigate(report, ownerEmail, ownerAccountID, {title, descrip // Sometimes title or description is undefined, so we need to check for that, and we provide it to multiple functions const reportName = (title || report.reportName).trim(); - const reportDescription = (!_.isUndefined(description) ? description : report.description).trim(); + + // Description can be unset, so we default to an empty string if so + const reportDescription = (!_.isUndefined(description) ? description : lodashGet(report, 'description', '')).trim(); // If we make a change to the assignee, we want to add a comment to the assignee's chat let optimisticAssigneeAddComment;