Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove optimistic personal detail after requesting money #28426

Merged
merged 8 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, {
isPolicyExpenseChat: false,
isExpenseReport: false,
policyID: null,
isOptimisticPersonalDetail: false,
};

const personalDetailMap = getPersonalDetailsForAccountIDs(accountIDs, personalDetails);
Expand All @@ -476,6 +477,7 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, {
let reportName;

result.participantsList = personalDetailList;
result.isOptimisticPersonalDetail = personalDetail.isOptimisticPersonalDetail;

if (report) {
result.isChatRoom = ReportUtils.isChatRoom(report);
Expand Down Expand Up @@ -1166,6 +1168,7 @@ function getOptions(
if (searchValue && !isSearchStringMatch(searchValue, searchText, participantNames, isChatRoom)) {
return;
}

personalDetailsOptions.push(personalDetailOption);
});
}
Expand All @@ -1177,7 +1180,10 @@ function getOptions(

let userToInvite = null;
const noOptions = recentReportOptions.length + personalDetailsOptions.length === 0 && !currentUserOption;
const noOptionsMatchExactly = !_.find(personalDetailsOptions.concat(recentReportOptions), (option) => option.login === addSMSDomainIfPhoneNumber(searchValue).toLowerCase());
const noOptionsMatchExactly = !_.find(
personalDetailsOptions.concat(recentReportOptions),
(option) => option.login === addSMSDomainIfPhoneNumber(searchValue).toLowerCase() || option.login === searchValue.toLowerCase(),
);

if (
searchValue &&
Expand Down Expand Up @@ -1246,7 +1252,7 @@ function getOptions(
}

return {
personalDetails: personalDetailsOptions,
personalDetails: _.filter(personalDetailsOptions, (personalDetailsOption) => !personalDetailsOption.isOptimisticPersonalDetail),
recentReports: recentReportOptions,
userToInvite: canInviteUser ? userToInvite : null,
currentUserOption,
Expand Down
2 changes: 2 additions & 0 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ function getMoneyRequestInformation(
avatar: UserUtils.getDefaultAvatarURL(payerAccountID),
displayName: LocalePhoneNumber.formatPhoneNumber(participant.displayName || payerEmail),
login: participant.login,
isOptimisticPersonalDetail: true,
},
}
: undefined;
Expand Down Expand Up @@ -1102,6 +1103,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
avatar: UserUtils.getDefaultAvatarURL(accountID),
displayName: LocalePhoneNumber.formatPhoneNumber(participant.displayName || email),
login: participant.login,
isOptimisticPersonalDetail: true,
},
}
: undefined;
Expand Down
Loading