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

Make sure reportRecepient exists before rendering ParticipantLocalTime #19650

Merged
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/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,6 @@ class ReportActionCompose extends React.Component {
const reportParticipants = _.without(lodashGet(this.props.report, 'participants', []), this.props.currentUserPersonalDetails.login);
const participantsWithoutExpensifyEmails = _.difference(reportParticipants, CONST.EXPENSIFY_EMAILS);
const reportRecipient = this.props.personalDetails[participantsWithoutExpensifyEmails[0]];

const shouldShowReportRecipientLocalTime = ReportUtils.canShowReportRecipientLocalTime(this.props.personalDetails, this.props.report) && !this.props.isComposerFullSize;

// Prevents focusing and showing the keyboard while the drawer is covering the chat.
Expand All @@ -916,6 +915,7 @@ class ReportActionCompose extends React.Component {
const shouldUseFocusedColor = !isBlockedFromConcierge && !this.props.disabled && (this.state.isFocused || this.state.isDraggingOver);
const hasExceededMaxCommentLength = this.state.hasExceededMaxCommentLength;
const isFullComposerAvailable = this.state.isFullComposerAvailable && !_.isEmpty(this.state.value);
const hasReportRecipient = _.isObject(reportRecipient) && !_.isEmpty(reportRecipient);

return (
<View
Expand All @@ -929,7 +929,7 @@ class ReportActionCompose extends React.Component {
style={this.props.isComposerFullSize ? styles.chatItemFullComposeRow : {}}
contentContainerStyle={this.props.isComposerFullSize ? styles.flex1 : {}}
>
{shouldShowReportRecipientLocalTime && <ParticipantLocalTime participant={reportRecipient} />}
{shouldShowReportRecipientLocalTime && hasReportRecipient && <ParticipantLocalTime participant={reportRecipient} />}
<View
style={[
shouldUseFocusedColor ? styles.chatItemComposeBoxFocusedColor : styles.chatItemComposeBoxColor,
Expand Down