-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Update Who Paid section when can modify participants #21945
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -132,6 +132,8 @@ function MoneyRequestConfirmationList(props) { | |||||||
|
||||||||
const selectedParticipants = useMemo(() => _.filter(props.participants, (participant) => participant.selected), [props.participants]); | ||||||||
const payeePersonalDetails = useMemo(() => props.payeePersonalDetails || props.currentUserPersonalDetails, [props.payeePersonalDetails, props.currentUserPersonalDetails]); | ||||||||
const canModifyParticipants = !props.isReadOnly && props.canModifyParticipants && props.hasMultipleParticipants; | ||||||||
const shouldDisableWhoPaidSection = canModifyParticipants; | ||||||||
|
||||||||
const optionSelectorSections = useMemo(() => { | ||||||||
const sections = []; | ||||||||
|
@@ -152,6 +154,7 @@ function MoneyRequestConfirmationList(props) { | |||||||
data: [formattedPayeeOption], | ||||||||
shouldShow: true, | ||||||||
indexOffset: 0, | ||||||||
isDisabled: shouldDisableWhoPaidSection, | ||||||||
}, | ||||||||
{ | ||||||||
title: translate('moneyRequestConfirmationList.whoWasThere'), | ||||||||
|
@@ -169,7 +172,17 @@ function MoneyRequestConfirmationList(props) { | |||||||
}); | ||||||||
} | ||||||||
return sections; | ||||||||
}, [selectedParticipants, getParticipantsWithAmount, props.hasMultipleParticipants, props.iouAmount, props.iouCurrencyCode, props.participants, translate, payeePersonalDetails]); | ||||||||
}, [ | ||||||||
props.participants, | ||||||||
props.hasMultipleParticipants, | ||||||||
props.iouAmount, | ||||||||
props.iouCurrencyCode, | ||||||||
getParticipantsWithAmount, | ||||||||
selectedParticipants, | ||||||||
payeePersonalDetails, | ||||||||
translate, | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why we need NAB (as it's not added here) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It gets flagged as a missing dependency by the linter otherwise (of course we could ignore the linter in this case, but I think it's fine to just include it). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh interesting, thanks for calling that out. I was previously under the impression that including There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you're right. Maybe the below make it clear. App/src/components/MoneyRequestConfirmationList.js Lines 102 to 104 in b595101
|
||||||||
shouldDisableWhoPaidSection, | ||||||||
]); | ||||||||
|
||||||||
const selectedOptions = useMemo(() => { | ||||||||
if (!props.hasMultipleParticipants) { | ||||||||
|
@@ -228,7 +241,6 @@ function MoneyRequestConfirmationList(props) { | |||||||
[selectedParticipants, onSendMoney, onConfirm, props.iouType], | ||||||||
); | ||||||||
|
||||||||
const canModifyParticipants = !props.isReadOnly && props.canModifyParticipants && props.hasMultipleParticipants; | ||||||||
const formattedAmount = CurrencyUtils.convertToDisplayString(props.iouAmount, props.iouCurrencyCode); | ||||||||
|
||||||||
const footerContent = useMemo(() => { | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a better naming here
canModifyParticipants
off as we are not modifying who paid anyway?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How's about
shouldDisableWhoPaidSection
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okayish make the changes, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it, thank you.