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 IOU report header and undefined in money request LHN #20752

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
4 changes: 2 additions & 2 deletions src/components/AvatarWithDisplayName.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ const defaultProps = {
};

function AvatarWithDisplayName(props) {
const title = props.isAnonymous ? props.report.displayName : ReportUtils.getDisplayNameForParticipant(props.report.ownerEmail, true);
const title = props.isAnonymous ? props.report.displayName : ReportUtils.getDisplayNameForParticipant(props.report.ownerAccountID, true);
const subtitle = ReportUtils.getChatRoomSubtitle(props.report);
const isExpenseReport = ReportUtils.isExpenseReport(props.report);
const icons = ReportUtils.getIcons(props.report, props.personalDetails, props.policies);
const ownerPersonalDetails = OptionsListUtils.getPersonalDetailsForAccountIDs([props.report.ownerAccountID], props.personalDetails);
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(ownerPersonalDetails, false);
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(_.values(ownerPersonalDetails), false);
const avatarContainerStyle = StyleUtils.getEmptyAvatarStyle(props.size) || styles.emptyAvatar;
return (
<View style={[styles.appContentHeaderTitle, styles.flex1]}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/IOUPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const propTypes = {
personalDetails: PropTypes.objectOf(
PropTypes.shape({
/** This is either the user's full name, or their login if full name is an empty string */
displayName: PropTypes.string.isRequired,
displayName: PropTypes.string,
}),
),

Expand Down
3 changes: 2 additions & 1 deletion src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ function getAccountIDForLogin(login) {

/**
* Get the displayName for a single report participant.
* Defaults to login if no display name is set.
*
* @param {Number} accountID
* @param {Boolean} [shouldUseShortForm]
Expand All @@ -842,7 +843,7 @@ function getDisplayNameForParticipant(accountID, shouldUseShortForm = false) {
return '';
}
const personalDetails = getPersonalDetailsForAccountID(accountID);
const longName = personalDetails.displayName;
const longName = personalDetails.displayName || (personalDetails.login && Str.removeSMSDomain(personalDetails.login));
const shortName = personalDetails.firstName || longName;
return shouldUseShortForm ? shortName : longName;
}
Expand Down