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

[Personal Details List migration]fix: show search value when searching for new account #20576

Merged
Show file tree
Hide file tree
Changes from 2 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
18 changes: 15 additions & 3 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,16 +758,28 @@ function getOptions(
!_.find(loginOptionsToExclude, (loginOptionToExclude) => loginOptionToExclude.login === addSMSDomainIfPhoneNumber(searchValue).toLowerCase()) &&
(searchValue !== CONST.EMAIL.CHRONOS || Permissions.canUseChronos(betas))
) {
const fakeAccountID = UserUtils.generateAccountID();
userToInvite = createOption([fakeAccountID], personalDetails, null, reportActions, {
// Generates an optimistic account ID for new users not yet
// saved in Onyx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Generates an optimistic account ID for new users not yet
// saved in Onyx
// Generates an optimistic account ID for new users not yet saved in Onyx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, just set it to ready!

const optimisticAccountID = UserUtils.generateAccountID();
const personalDetailsExtended = {
...personalDetails,
[optimisticAccountID]: {
accountID: optimisticAccountID,
login: searchValue,
avatar: UserUtils.getDefaultAvatar(optimisticAccountID),
},
};
userToInvite = createOption([optimisticAccountID], personalDetailsExtended, null, reportActions, {
showChatPreviewLine,
});
userToInvite.login = searchValue;
userToInvite.text = userToInvite.text || searchValue;
userToInvite.alternateText = userToInvite.alternateText || searchValue;

// If user doesn't exist, use a default avatar
userToInvite.icons = [
{
source: UserUtils.getAvatar('', fakeAccountID),
source: UserUtils.getAvatar('', optimisticAccountID),
login: searchValue,
type: CONST.ICON_TYPE_AVATAR,
},
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ function getDisplayNameForParticipant(accountID, shouldUseShortForm = false) {
function getDisplayNamesWithTooltips(participants, isMultipleParticipantReport) {
return _.map(participants, (participant) => {
const personalDetails = getPersonalDetailsForAccountID(participant.accountID);
const displayName = getDisplayNameForParticipant(participant.accountID, isMultipleParticipantReport);
const displayName = getDisplayNameForParticipant(participant.accountID, isMultipleParticipantReport) || participant.login;

const tooltip = personalDetails.login ? Str.removeSMSDomain(personalDetails.login) : '';

Expand Down