Skip to content

Commit

Permalink
Merge pull request #21945 from ginsuma/fix/21695
Browse files Browse the repository at this point in the history
Update Who Paid section when can modify participants
  • Loading branch information
amyevans authored Jul 6, 2023
2 parents 0ca7948 + 64ff1d1 commit b595101
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand All @@ -152,6 +154,7 @@ function MoneyRequestConfirmationList(props) {
data: [formattedPayeeOption],
shouldShow: true,
indexOffset: 0,
isDisabled: shouldDisableWhoPaidSection,
},
{
title: translate('moneyRequestConfirmationList.whoWasThere'),
Expand All @@ -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,
shouldDisableWhoPaidSection,
]);

const selectedOptions = useMemo(() => {
if (!props.hasMultipleParticipants) {
Expand Down Expand Up @@ -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(() => {
Expand Down

0 comments on commit b595101

Please sign in to comment.