Skip to content

Commit

Permalink
Merge pull request #48307 from ahmedGaber93/revert-47214-fix/46739
Browse files Browse the repository at this point in the history
Revert "fix: remove Expensify employee from list participants"
  • Loading branch information
puneetlath authored Aug 30, 2024
2 parents eb57e57 + 60364e4 commit 81e03eb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 41 deletions.
56 changes: 27 additions & 29 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -528,35 +528,33 @@ function MoneyRequestConfirmationList({
const currencySymbol = currencyList?.[iouCurrencyCode ?? '']?.symbol ?? iouCurrencyCode;
const formattedTotalAmount = CurrencyUtils.convertToDisplayStringWithoutCurrency(iouAmount, iouCurrencyCode);

return [payeeOption, ...selectedParticipants]
.filter((participantOption) => !PolicyUtils.isExpensifyTeam(participantOption.login))
.map((participantOption: Participant) => ({
...participantOption,
tabIndex: -1,
isSelected: false,
isInteractive: !shouldDisableParticipant(participantOption),
rightElement: (
<MoneyRequestAmountInput
autoGrow={false}
amount={transaction?.splitShares?.[participantOption.accountID ?? -1]?.amount}
currency={iouCurrencyCode}
prefixCharacter={currencySymbol}
disableKeyboard={false}
isCurrencyPressable={false}
hideFocusedState={false}
hideCurrencySymbol
formatAmountOnBlur
prefixContainerStyle={[styles.pv0]}
inputStyle={[styles.optionRowAmountInput]}
containerStyle={[styles.textInputContainer]}
touchableInputWrapperStyle={[styles.ml3]}
onFormatAmount={CurrencyUtils.convertToDisplayStringWithoutCurrency}
onAmountChange={(value: string) => onSplitShareChange(participantOption.accountID ?? -1, Number(value))}
maxLength={formattedTotalAmount.length}
contentWidth={formattedTotalAmount.length * 8}
/>
),
}));
return [payeeOption, ...selectedParticipants].map((participantOption: Participant) => ({
...participantOption,
tabIndex: -1,
isSelected: false,
isInteractive: !shouldDisableParticipant(participantOption),
rightElement: (
<MoneyRequestAmountInput
autoGrow={false}
amount={transaction?.splitShares?.[participantOption.accountID ?? -1]?.amount}
currency={iouCurrencyCode}
prefixCharacter={currencySymbol}
disableKeyboard={false}
isCurrencyPressable={false}
hideFocusedState={false}
hideCurrencySymbol
formatAmountOnBlur
prefixContainerStyle={[styles.pv0]}
inputStyle={[styles.optionRowAmountInput]}
containerStyle={[styles.textInputContainer]}
touchableInputWrapperStyle={[styles.ml3]}
onFormatAmount={CurrencyUtils.convertToDisplayStringWithoutCurrency}
onAmountChange={(value: string) => onSplitShareChange(participantOption.accountID ?? -1, Number(value))}
maxLength={formattedTotalAmount.length}
contentWidth={formattedTotalAmount.length * 8}
/>
),
}));
}, [
isTypeSplit,
payeePersonalDetails,
Expand Down
4 changes: 1 addition & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6394,9 +6394,7 @@ function getMoneyRequestOptions(report: OnyxEntry<Report>, policy: OnyxEntry<Pol
return [];
}

const otherParticipants = reportParticipants.filter(
(accountID) => currentUserPersonalDetails?.accountID !== accountID && !PolicyUtils.isExpensifyTeam(allPersonalDetails?.[accountID]?.login),
);
const otherParticipants = reportParticipants.filter((accountID) => currentUserPersonalDetails?.accountID !== accountID);
const hasSingleParticipantInReport = otherParticipants.length === 1;
let options: IOUType[] = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {FileObject} from '@components/AttachmentModal';
import AttachmentPicker from '@components/AttachmentPicker';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import {usePersonalDetails} from '@components/OnyxProvider';
import type {PopoverMenuItem} from '@components/PopoverMenu';
import PopoverMenu from '@components/PopoverMenu';
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
Expand Down Expand Up @@ -123,7 +122,6 @@ function AttachmentPickerWithMenuItems({
const {translate} = useLocalize();
const {windowHeight, windowWidth} = useWindowDimensions();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const allPersonalDetails = usePersonalDetails();

/**
* Returns the list of IOU Options
Expand Down Expand Up @@ -169,8 +167,7 @@ function AttachmentPickerWithMenuItems({
return ReportUtils.temporary_getMoneyRequestOptions(report, policy, reportParticipantIDs ?? []).map((option) => ({
...options[option],
}));
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [translate, report, policy, reportParticipantIDs, allPersonalDetails]);
}, [translate, report, policy, reportParticipantIDs]);

/**
* Determines if we can show the task option
Expand Down
6 changes: 1 addition & 5 deletions src/pages/iou/request/step/IOURequestStepAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import * as TransactionEdit from '@libs/actions/TransactionEdit';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ReportUtils from '@libs/ReportUtils';
import * as TransactionUtils from '@libs/TransactionUtils';
import {getRequestType} from '@libs/TransactionUtils';
Expand Down Expand Up @@ -80,7 +79,6 @@ function IOURequestStepAmount({
const isSaveButtonPressed = useRef(false);
const iouRequestType = getRequestType(transaction);
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID ?? -1}`);
const [allPersonalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);

const isEditing = action === CONST.IOU.ACTION.EDIT;
const isSplitBill = iouType === CONST.IOU.TYPE.SPLIT;
Expand Down Expand Up @@ -255,9 +253,7 @@ function IOURequestStepAmount({
}
IOU.setMoneyRequestParticipantsFromReport(transactionID, report);
if (isSplitBill && !report.isOwnPolicyExpenseChat && report.participants) {
const participantAccountIDs = Object.keys(report.participants)
.map((accountID) => Number(accountID))
.filter((accountID) => !PolicyUtils.isExpensifyTeam(allPersonalDetails?.[accountID]?.login));
const participantAccountIDs = Object.keys(report.participants).map((accountID) => Number(accountID));
IOU.setSplitShares(transaction, amountInSmallestCurrencyUnits, currency || CONST.CURRENCY.USD, participantAccountIDs);
}
navigateToConfirmationPage();
Expand Down

0 comments on commit 81e03eb

Please sign in to comment.