Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
df1d586
fix: remove currentUserEmail from Onyx.connect
linhvovan29546 Jan 1, 2026
f0f50d9
chore: remove currentUserEmail from onyx
linhvovan29546 Jan 1, 2026
b1faaff
chore: disable estlint until migration success
linhvovan29546 Jan 2, 2026
611b998
chore: prettier
linhvovan29546 Jan 2, 2026
dc8b49f
chore: make current user email required
linhvovan29546 Jan 2, 2026
5bcaeee
chore: pass email to isSplitAction
linhvovan29546 Jan 2, 2026
23fdb8a
test: add test for short mention in comment edits
linhvovan29546 Jan 2, 2026
bafad57
test: add test export to accounting action
linhvovan29546 Jan 2, 2026
f378b04
test: add test export to accounting action
linhvovan29546 Jan 2, 2026
975f680
chore: update prop
linhvovan29546 Jan 2, 2026
51303ad
chore: eslint fail
linhvovan29546 Jan 2, 2026
543bae4
chore: rename param
linhvovan29546 Jan 4, 2026
93242bc
chore: update current user email and account id to deprecated
linhvovan29546 Jan 4, 2026
2f13241
chore: update param name
linhvovan29546 Jan 4, 2026
81d3e67
Merge branch 'main' into fix/73648-remove-onyxkey-session-in-report-p…
linhvovan29546 Jan 7, 2026
af0bbb4
test: test fail after merge main
linhvovan29546 Jan 7, 2026
fb64b0b
Merge branch 'main' into fix/73648-remove-onyxkey-session-in-report-p…
linhvovan29546 Jan 8, 2026
68900ba
Update Mobile-Expensify submodule to match main
linhvovan29546 Jan 8, 2026
d56de90
chore: eslint fail
linhvovan29546 Jan 8, 2026
68f519c
chore: rename currentUserEmail to currentUserLogin
linhvovan29546 Jan 9, 2026
a56f33c
chore: migrate email field to login
linhvovan29546 Jan 9, 2026
af76efb
chore: migrate email field to login
linhvovan29546 Jan 9, 2026
6c12a49
chore: migrate email field to login
linhvovan29546 Jan 9, 2026
a7ef374
Merge branch 'main' into fix/73648-remove-onyxkey-session-in-report-p…
linhvovan29546 Jan 9, 2026
c4e9016
chore: add login to deps
linhvovan29546 Jan 9, 2026
fa3a028
chore: migrate email field to login
linhvovan29546 Jan 9, 2026
fb6340b
chore: migrate email field to login
linhvovan29546 Jan 9, 2026
8f99610
Merge branch 'main' into fix/73648-remove-onyxkey-session-in-report-p…
linhvovan29546 Jan 12, 2026
290ffec
chore: update prop name
linhvovan29546 Jan 12, 2026
51fd696
chore: fix typecheck fail
linhvovan29546 Jan 12, 2026
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
10 changes: 5 additions & 5 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ function MoneyReportHeader({

const primaryAction = useMemo(() => {
return getReportPrimaryAction({
currentUserEmail: currentUserLogin ?? '',
currentUserLogin: currentUserLogin ?? '',
currentUserAccountID: accountID,
report: moneyRequestReport,
chatReport,
Expand Down Expand Up @@ -1073,7 +1073,7 @@ function MoneyReportHeader({
return [];
}
return getSecondaryReportActions({
currentUserEmail: currentUserLogin ?? '',
currentUserLogin: currentUserLogin ?? '',
currentUserAccountID: accountID,
report: moneyRequestReport,
chatReport,
Expand Down Expand Up @@ -1517,9 +1517,9 @@ function MoneyReportHeader({
if (!hasFinishedPDFDownload || !canTriggerAutomaticPDFDownload.current) {
return;
}
downloadReportPDF(reportPDFFilename, moneyRequestReport?.reportName ?? '', translate);
downloadReportPDF(reportPDFFilename, moneyRequestReport?.reportName ?? '', translate, currentUserLogin ?? '');
canTriggerAutomaticPDFDownload.current = false;
}, [hasFinishedPDFDownload, reportPDFFilename, moneyRequestReport?.reportName, translate]);
}, [hasFinishedPDFDownload, reportPDFFilename, moneyRequestReport?.reportName, translate, currentUserLogin]);

const shouldShowBackButton = shouldDisplayBackButton || shouldUseNarrowLayout;

Expand Down Expand Up @@ -1828,7 +1828,7 @@ function MoneyReportHeader({
if (!hasFinishedPDFDownload) {
setIsPDFModalVisible(false);
} else {
downloadReportPDF(reportPDFFilename, moneyRequestReport?.reportName ?? '', translate);
downloadReportPDF(reportPDFFilename, moneyRequestReport?.reportName ?? '', translate, currentUserLogin ?? '');
}
}}
text={hasFinishedPDFDownload ? translate('common.download') : translate('common.cancel')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ function MoneyRequestReportPreviewContent({
return getReportPreviewAction({
isReportArchived: isIouReportArchived || isChatReportArchived,
currentUserAccountID: currentUserDetails.accountID,
currentUserEmail: currentUserDetails.email ?? '',
currentUserLogin: currentUserDetails.login ?? '',
report: iouReport,
policy,
transactions,
Expand All @@ -544,7 +544,7 @@ function MoneyRequestReportPreviewContent({
isIouReportArchived,
isChatReportArchived,
currentUserDetails.accountID,
currentUserDetails.email,
currentUserDetails.login,
iouReport,
policy,
transactions,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function MoneyRequestView({
const companyCardPageURL = `${environmentURL}/${ROUTES.WORKSPACE_COMPANY_CARDS.getRoute(transactionThreadReport?.policyID)}`;
const [originalTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(transaction?.comment?.originalTransactionID)}`, {canBeMissing: true});
const {isExpenseSplit} = getOriginalTransactionWithSplitInfo(transaction, originalTransaction);
const isSplitAvailable = moneyRequestReport && transaction && isSplitAction(moneyRequestReport, [transaction], originalTransaction, policy);
const isSplitAvailable = moneyRequestReport && transaction && isSplitAction(moneyRequestReport, [transaction], originalTransaction, currentUserPersonalDetails.login ?? '', policy);

const canEditTaxFields = canEdit && !isDistanceRequest;
const canEditAmount =
Expand Down
11 changes: 5 additions & 6 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ function mapTransactionItemToSelectedEntry(
): [string, SelectedTransactionInfo] {
const {canHoldRequest, canUnholdRequest} = canHoldUnholdReportAction(item.report, item.reportAction, item.holdReportAction, item, item.policy);
const canRejectRequest = item.report ? canRejectReportAction(currentUserLogin, item.report, item.policy) : false;

return [
item.keyForList,
{
Expand All @@ -109,7 +108,7 @@ function mapTransactionItemToSelectedEntry(
canHold: canHoldRequest,
isHeld: isOnHold(item),
canUnhold: canUnholdRequest,
canSplit: isSplitAction(item.report, [itemTransaction], originalItemTransaction, item.policy),
canSplit: isSplitAction(item.report, [itemTransaction], originalItemTransaction, currentUserLogin, item.policy),
hasBeenSplit: getOriginalTransactionWithSplitInfo(itemTransaction, originalItemTransaction).isExpenseSplit,
canChangeReport: canEditFieldOfMoneyRequest(
item.reportAction,
Expand Down Expand Up @@ -161,7 +160,7 @@ function prepareTransactionsList(
canHold: canHoldRequest,
isHeld: isOnHold(item),
canUnhold: canUnholdRequest,
canSplit: isSplitAction(item.report, [itemTransaction], originalItemTransaction, item.policy),
canSplit: isSplitAction(item.report, [itemTransaction], originalItemTransaction, currentUserLogin, item.policy),
hasBeenSplit: getOriginalTransactionWithSplitInfo(itemTransaction, originalItemTransaction).isExpenseSplit,
canChangeReport: canEditFieldOfMoneyRequest(
item.reportAction,
Expand Down Expand Up @@ -245,7 +244,7 @@ function Search({
const [reportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS, {canBeMissing: true});
const [outstandingReportsByPolicyID] = useOnyx(ONYXKEYS.DERIVED.OUTSTANDING_REPORTS_BY_POLICY_ID, {canBeMissing: true});
const [violations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {canBeMissing: true});
const {accountID, email} = useCurrentUserPersonalDetails();
const {accountID, email, login} = useCurrentUserPersonalDetails();
const [isActionLoadingSet = new Set<string>()] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}`, {canBeMissing: true, selector: isActionLoadingSetSelector});
const [visibleColumns] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true, selector: columnsSelector});
const [customCardNames] = useOnyx(ONYXKEYS.NVP_EXPENSIFY_COMPANY_CARDS_CUSTOM_NAMES, {canBeMissing: true});
Expand Down Expand Up @@ -520,7 +519,7 @@ function Search({
canHold: canHoldRequest,
isHeld: isOnHold(transactionItem),
canUnhold: canUnholdRequest,
canSplit: isSplitAction(transactionItem.report, [itemTransaction], originalItemTransaction, transactionItem.policy),
canSplit: isSplitAction(transactionItem.report, [itemTransaction], originalItemTransaction, login ?? '', transactionItem.policy),
hasBeenSplit: getOriginalTransactionWithSplitInfo(itemTransaction, originalItemTransaction).isExpenseSplit,
canChangeReport: canEditFieldOfMoneyRequest(
transactionItem.reportAction,
Expand Down Expand Up @@ -573,7 +572,7 @@ function Search({
canHold: canHoldRequest,
isHeld: isOnHold(transactionItem),
canUnhold: canUnholdRequest,
canSplit: isSplitAction(transactionItem.report, [itemTransaction], originalItemTransaction, transactionItem.policy),
canSplit: isSplitAction(transactionItem.report, [itemTransaction], originalItemTransaction, login ?? '', transactionItem.policy),
hasBeenSplit: getOriginalTransactionWithSplitInfo(itemTransaction, originalItemTransaction).isExpenseSplit,
canChangeReport: canEditFieldOfMoneyRequest(
transactionItem.reportAction,
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useSelectedTransactionsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Policy, Report, ReportAction, Session, Transaction} from '@src/types/onyx';
import useAllTransactions from './useAllTransactions';
import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails';
import useDeleteTransactions from './useDeleteTransactions';
import useDuplicateTransactionsAndViolations from './useDuplicateTransactionsAndViolations';
import {useMemoizedLazyExpensifyIcons} from './useLazyAsset';
Expand Down Expand Up @@ -77,6 +78,7 @@ function useSelectedTransactionsActions({
const {duplicateTransactions, duplicateTransactionViolations} = useDuplicateTransactionsAndViolations(selectedTransactionIDs);
const isReportArchived = useReportIsArchived(report?.reportID);
const {deleteTransactions} = useDeleteTransactions({report, reportActions, policy});
const {login} = useCurrentUserPersonalDetails();
const selectedTransactionsList = useMemo(
() =>
selectedTransactionIDs.reduce((acc, transactionID) => {
Expand Down Expand Up @@ -330,7 +332,7 @@ function useSelectedTransactionsActions({
const originalTransaction = allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${firstTransaction?.comment?.originalTransactionID}`];

const {isExpenseSplit} = getOriginalTransactionWithSplitInfo(firstTransaction, originalTransaction);
const canSplitTransaction = selectedTransactionsList.length === 1 && report && !isExpenseSplit && isSplitAction(report, [firstTransaction], originalTransaction, policy);
const canSplitTransaction = selectedTransactionsList.length === 1 && report && !isExpenseSplit && isSplitAction(report, [firstTransaction], originalTransaction, login ?? '', policy);

if (canSplitTransaction) {
options.push({
Expand Down Expand Up @@ -400,6 +402,7 @@ function useSelectedTransactionsActions({
expensifyIcons.Trashcan,
localeCompare,
isOnSearch,
login,
]);

return {
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useTodos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function useTodos() {
const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {canBeMissing: false});
const [allReportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS, {canBeMissing: false});
const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST, {canBeMissing: true});
const {email = '', accountID} = useCurrentUserPersonalDetails();
const {login = '', accountID} = useCurrentUserPersonalDetails();

return useMemo(() => {
const reportsToSubmit: Report[] = [];
Expand Down Expand Up @@ -51,14 +51,14 @@ export default function useTodos() {
if (isApproveAction(report, reportTransactions, policy)) {
reportsToApprove.push(report);
}
if (isPrimaryPayAction(report, accountID, email, bankAccountList, policy, reportNameValuePair)) {
if (isPrimaryPayAction(report, accountID, login, bankAccountList, policy, reportNameValuePair)) {
reportsToPay.push(report);
}
if (isExportAction(report, policy, reportActions)) {
if (isExportAction(report, login, policy, reportActions)) {
reportsToExport.push(report);
}
}

return {reportsToSubmit, reportsToApprove, reportsToPay, reportsToExport};
}, [allReports, allTransactions, allPolicies, allReportNameValuePairs, allReportActions, accountID, email, bankAccountList]);
}, [allReports, allTransactions, allPolicies, allReportNameValuePairs, allReportActions, accountID, login, bankAccountList]);
}
6 changes: 2 additions & 4 deletions src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import {getBankAccountFromID} from './actions/BankAccounts';
import {hasSynchronizationErrorMessage, isConnectionUnverified} from './actions/connections';
import {shouldShowQBOReimbursableExportDestinationAccountError} from './actions/connections/QuickbooksOnline';
import {getCurrentUserEmail} from './actions/Report';
import {getCategoryApproverRule} from './CategoryUtils';
import Navigation from './Navigation/Navigation';
import {isOffline as isOfflineNetworkStore} from './Network/NetworkStore';
Expand All @@ -60,7 +59,7 @@

let allPolicies: OnyxCollection<Policy>;

Onyx.connect({

Check warning on line 62 in src/libs/PolicyUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => (allPolicies = value),
Expand Down Expand Up @@ -1610,8 +1609,7 @@
return domainName;
};

function isPreferredExporter(policy: Policy) {
const user = getCurrentUserEmail();
function isPreferredExporter(policy: Policy, currentUserLogin: string) {
const exporters = [
policy.connections?.intacct?.config?.export?.exporter,
policy.connections?.netsuite?.options?.config?.exporter,
Expand All @@ -1620,7 +1618,7 @@
policy.connections?.xero?.config?.export?.exporter,
];

return exporters.some((exporter) => exporter && exporter === user);
return exporters.some((exporter) => exporter && exporter === currentUserLogin);
}

/**
Expand Down
18 changes: 9 additions & 9 deletions src/libs/ReportPreviewActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function canPay(
report: Report,
isReportArchived: boolean,
currentUserAccountID: number,
currentUserEmail: string,
currentUserLogin: string,
bankAccountList: OnyxEntry<BankAccountList>,
policy?: Policy,
invoiceReceiverPolicy?: Policy,
Expand All @@ -99,7 +99,7 @@ function canPay(
return false;
}

const isReportPayer = isPayer(currentUserAccountID, currentUserEmail, report, bankAccountList, policy, false);
const isReportPayer = isPayer(currentUserAccountID, currentUserLogin, report, bankAccountList, policy, false);
const isExpense = isExpenseReport(report);
const isPaymentsEnabled = arePaymentsEnabled(policy);
const isProcessing = isProcessingReport(report);
Expand Down Expand Up @@ -143,9 +143,9 @@ function canPay(
return invoiceReceiverPolicy?.role === CONST.POLICY.ROLE.ADMIN && reimbursableSpend > 0;
}

function canExport(report: Report, policy?: Policy) {
function canExport(report: Report, currentUserLogin: string, policy?: Policy) {
const isExpense = isExpenseReport(report);
const isExporter = policy ? isPreferredExporter(policy) : false;
const isExporter = policy ? isPreferredExporter(policy, currentUserLogin) : false;
const isReimbursed = isSettled(report);
const isClosed = isClosedReport(report);
const isApproved = isReportApproved({report});
Expand Down Expand Up @@ -176,7 +176,7 @@ function canExport(report: Report, policy?: Policy) {
function getReportPreviewAction({
isReportArchived,
currentUserAccountID,
currentUserEmail,
currentUserLogin,
report,
policy,
transactions,
Expand All @@ -190,7 +190,7 @@ function getReportPreviewAction({
}: {
isReportArchived: boolean;
currentUserAccountID: number;
currentUserEmail: string;
currentUserLogin: string;
report: Report | undefined;
policy: Policy | undefined;
transactions: Transaction[];
Expand Down Expand Up @@ -223,16 +223,16 @@ function getReportPreviewAction({
return CONST.REPORT.REPORT_PREVIEW_ACTIONS.VIEW;
}

if (canSubmit(report, isReportArchived, currentUserAccountID, currentUserEmail, violationsData, policy, transactions)) {
if (canSubmit(report, isReportArchived, currentUserAccountID, currentUserLogin, violationsData, policy, transactions)) {
return CONST.REPORT.REPORT_PREVIEW_ACTIONS.SUBMIT;
}
if (canApprove(report, currentUserAccountID, policy, transactions)) {
return CONST.REPORT.REPORT_PREVIEW_ACTIONS.APPROVE;
}
if (canPay(report, isReportArchived, currentUserAccountID, currentUserEmail, bankAccountList, policy, invoiceReceiverPolicy)) {
if (canPay(report, isReportArchived, currentUserAccountID, currentUserLogin, bankAccountList, policy, invoiceReceiverPolicy)) {
return CONST.REPORT.REPORT_PREVIEW_ACTIONS.PAY;
}
if (canExport(report, policy)) {
if (canExport(report, currentUserLogin, policy)) {
return CONST.REPORT.REPORT_PREVIEW_ACTIONS.EXPORT_TO_ACCOUNTING;
}

Expand Down
Loading
Loading