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

Ensure deleted and settled request messages show as text #18898

Merged
merged 5 commits into from
May 14, 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
6 changes: 1 addition & 5 deletions src/components/ReportActionItem/IOUPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,7 @@ const defaultProps = {
};

const IOUPreview = (props) => {
// Usually the parent determines whether the IOU Preview is displayed. But as the iouReport total cannot be known
// until it is stored locally, we need to make this check within the Component after retrieving it. This allows us
// to handle the loading UI from within this Component instead of needing to declare it within each parent, which
// would duplicate and complicate the logic
if (props.iouReport.total === 0) {
if (_.isEmpty(props.iouReport)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if we need such elaborate comment for this anymore

return null;
}
const sessionEmail = lodashGet(props.session, 'email', null);
Expand Down
3 changes: 2 additions & 1 deletion src/components/ReportActionItem/MoneyRequestAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ from 'underscore';
import React from 'react';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import lodashGet from 'lodash/get';
import ONYXKEYS from '../../ONYXKEYS';
import CONST from '../../CONST';
import {withNetwork} from '../OnyxProvider';
Expand Down Expand Up @@ -69,7 +70,7 @@ const defaultProps = {
};

const MoneyRequestAction = (props) => {
const hasMultipleParticipants = props.chatReport.participants.length > 1;
const hasMultipleParticipants = lodashGet(props.chatReport, 'participants', []).length > 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was running to same issues now as I have the Backend adding the actions to the iou/expense reports, it was crashing the app so this is accessing the property safely. Should be better than nothing

const onIOUPreviewPressed = () => {
if (hasMultipleParticipants) {
Navigation.navigate(ROUTES.getReportParticipantsRoute(props.chatReportID));
Expand Down
6 changes: 5 additions & 1 deletion src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ class ReportActionItem extends Component {
*/
renderItemContent(hovered = false) {
let children;
if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU) {
if (
this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU &&
this.props.action.originalMessage.type !== CONST.IOU.REPORT_ACTION_TYPE.DELETE &&
this.props.action.originalMessage.type !== CONST.IOU.REPORT_ACTION_TYPE.PAY
) {
// There is no single iouReport for bill splits, so only 1:1 requests require an iouReportID
const iouReportID = this.props.action.originalMessage.IOUReportID ? this.props.action.originalMessage.IOUReportID.toString() : '0';

Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/IOUDetailsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class IOUDetailsModal extends Component {
<IOUPreview
chatReportID={this.props.route.params.chatReportID}
iouReportID={this.props.route.params.iouReportID}
isBillSplit={this.props.chatReport.participants.length > 1}
isBillSplit={lodashGet(this.props, 'chatReport.participants', []).length > 1}
isIOUAction={false}
pendingAction={pendingAction}
/>
Expand Down