From 6d9c8e821d9ba8a93790a2e4d59e76f1d8322c3f Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Fri, 2 Dec 2022 10:49:36 -0700 Subject: [PATCH 1/4] Correct the logic for when bill split particpants can be selected --- src/components/IOUConfirmationList.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/IOUConfirmationList.js b/src/components/IOUConfirmationList.js index 4f4eb415ed4b6..36cfa27f644ec 100755 --- a/src/components/IOUConfirmationList.js +++ b/src/components/IOUConfirmationList.js @@ -275,7 +275,11 @@ class IOUConfirmationList extends Component { const shouldShowSettlementButton = this.props.iouType === CONST.IOU.IOU_TYPE.SEND; const shouldDisableButton = selectedParticipants.length === 0; const recipient = this.state.participants[0]; - const canModifyParticipants = !this.props.isIOUAttachedToExistingChatReport && this.props.hasMultipleParticipants; + + // The participants can only be modified when: + // 1. The action is initiated from directly within a group chat and not the floating-action-button (eg. this.props.isIOUAttachedToExistingChatReport === true) + // 2. There are multiple participants (eg. this.props.hasMultipleParticipants === true) + const canModifyParticipants = this.props.isIOUAttachedToExistingChatReport && this.props.hasMultipleParticipants; return ( Date: Fri, 2 Dec 2022 10:49:36 -0700 Subject: [PATCH 2/4] Correct the logic for when bill split particpants can be selected --- src/components/IOUConfirmationList.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/IOUConfirmationList.js b/src/components/IOUConfirmationList.js index 4f4eb415ed4b6..06e8b132c9434 100755 --- a/src/components/IOUConfirmationList.js +++ b/src/components/IOUConfirmationList.js @@ -275,7 +275,13 @@ class IOUConfirmationList extends Component { const shouldShowSettlementButton = this.props.iouType === CONST.IOU.IOU_TYPE.SEND; const shouldDisableButton = selectedParticipants.length === 0; const recipient = this.state.participants[0]; - const canModifyParticipants = !this.props.isIOUAttachedToExistingChatReport && this.props.hasMultipleParticipants; + + // The participants can only be modified when: + // 1. The action is initiated from directly within a group chat and not the floating-action-button (eg. this.props.isIOUAttachedToExistingChatReport === true). This is because when + // there is a group of people, say they are on a trip, and you have some shared expenses with some of the people, but not all of them (maybe someone skipped out on dinner). Then + // it's nice to be able to select/deselect people from the group chat bill split rather than forcing the user to create a new group, just for that expense. + // 2. There are multiple participants (eg. this.props.hasMultipleParticipants === true). This is because splitting a bill with one person isn't a thing :D + const canModifyParticipants = this.props.isIOUAttachedToExistingChatReport && this.props.hasMultipleParticipants; return ( Date: Fri, 2 Dec 2022 10:54:17 -0700 Subject: [PATCH 3/4] Add more context to the comment in props --- src/components/IOUConfirmationList.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/IOUConfirmationList.js b/src/components/IOUConfirmationList.js index 06e8b132c9434..67bb596f34491 100755 --- a/src/components/IOUConfirmationList.js +++ b/src/components/IOUConfirmationList.js @@ -57,7 +57,8 @@ const propTypes = { phoneNumber: PropTypes.string, })).isRequired, - /** Is this IOU associated with existing report */ + /** Is this IOU associated with existing report. This is true when the action is initiated from inside a group chat and it's false when the action is initiated from the + * floating-action-button */ isIOUAttachedToExistingChatReport: PropTypes.bool.isRequired, ...windowDimensionsPropTypes, From 18ae34f5b833f8561bed2bcf9f002eba4d6dafe5 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Mon, 5 Dec 2022 07:57:55 -0700 Subject: [PATCH 4/4] Move comment and rename prop --- src/components/IOUConfirmationList.js | 14 ++++---------- src/pages/iou/IOUModal.js | 8 +++++++- src/pages/iou/steps/IOUConfirmPage.js | 7 ++++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/components/IOUConfirmationList.js b/src/components/IOUConfirmationList.js index 67bb596f34491..7e2de32e502df 100755 --- a/src/components/IOUConfirmationList.js +++ b/src/components/IOUConfirmationList.js @@ -57,9 +57,8 @@ const propTypes = { phoneNumber: PropTypes.string, })).isRequired, - /** Is this IOU associated with existing report. This is true when the action is initiated from inside a group chat and it's false when the action is initiated from the - * floating-action-button */ - isIOUAttachedToExistingChatReport: PropTypes.bool.isRequired, + /** Can the participants be modified or not */ + canModifyParticipants: PropTypes.bool, ...windowDimensionsPropTypes, @@ -92,6 +91,7 @@ const defaultProps = { onUpdateComment: null, comment: '', iouType: CONST.IOU.IOU_TYPE.REQUEST, + canModifyParticipants: false, ...withCurrentUserPersonalDetailsDefaultProps, }; @@ -276,13 +276,7 @@ class IOUConfirmationList extends Component { const shouldShowSettlementButton = this.props.iouType === CONST.IOU.IOU_TYPE.SEND; const shouldDisableButton = selectedParticipants.length === 0; const recipient = this.state.participants[0]; - - // The participants can only be modified when: - // 1. The action is initiated from directly within a group chat and not the floating-action-button (eg. this.props.isIOUAttachedToExistingChatReport === true). This is because when - // there is a group of people, say they are on a trip, and you have some shared expenses with some of the people, but not all of them (maybe someone skipped out on dinner). Then - // it's nice to be able to select/deselect people from the group chat bill split rather than forcing the user to create a new group, just for that expense. - // 2. There are multiple participants (eg. this.props.hasMultipleParticipants === true). This is because splitting a bill with one person isn't a thing :D - const canModifyParticipants = this.props.isIOUAttachedToExistingChatReport && this.props.hasMultipleParticipants; + const canModifyParticipants = this.props.canModifyParticipants && this.props.hasMultipleParticipants; return ( )} diff --git a/src/pages/iou/steps/IOUConfirmPage.js b/src/pages/iou/steps/IOUConfirmPage.js index c14626399f2ca..7f69fc7ef9a12 100644 --- a/src/pages/iou/steps/IOUConfirmPage.js +++ b/src/pages/iou/steps/IOUConfirmPage.js @@ -43,14 +43,15 @@ const propTypes = { /** IOU type */ iouType: PropTypes.string, - /** Is this IOU associated with existing report */ - isIOUAttachedToExistingChatReport: PropTypes.bool.isRequired, + /** Can the participants be modified or not */ + canModifyParticipants: PropTypes.bool, }; const defaultProps = { onUpdateComment: null, comment: '', iouType: CONST.IOU.IOU_TYPE.REQUEST, + canModifyParticipants: false, }; const IOUConfirmPage = props => ( @@ -63,7 +64,7 @@ const IOUConfirmPage = props => ( onConfirm={props.onConfirm} onSendMoney={props.onSendMoney} iouType={props.iouType} - isIOUAttachedToExistingChatReport={props.isIOUAttachedToExistingChatReport} + canModifyParticipants={props.canModifyParticipants} /> );