Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions src/components/LHNOptionsList/OptionRowLHNData.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {isTrackIntentUserSelector} from '@selectors/Onboarding';
import React, {useCallback, useMemo} from 'react';
import type {OnyxCollection} from 'react-native-onyx';
import useReportPreviewSenderID from '@components/ReportActionAvatars/useReportPreviewSenderID';
Expand Down Expand Up @@ -118,6 +119,7 @@ function OptionRowLHNData({
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const {login} = useCurrentUserPersonalDetails();
const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${fullReport?.policyID}`);
const [isTrackIntentUser] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {selector: isTrackIntentUserSelector});

const card = useGetExpensifyCardFromReportAction({reportAction: lastAction, policyID: fullReport?.policyID});

Expand Down Expand Up @@ -156,6 +158,7 @@ function OptionRowLHNData({
reportAttributesDerived,
policyTags,
currentUserLogin: login ?? '',
isTrackIntentUser,
});

// For single-sender IOUs, trim to the sender's avatar to match the header.
Expand Down
3 changes: 3 additions & 0 deletions src/components/ReportWelcomeText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {isTrackIntentUserSelector} from '@selectors/Onboarding';
import React from 'react';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useEnvironment from '@hooks/useEnvironment';
import useLocalize from '@hooks/useLocalize';
import useMappedPersonalDetails, {personalDetailMapper} from '@hooks/useMappedPersonalDetails';
Expand Down Expand Up @@ -66,6 +67,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) {
const participantAccountIDs = getParticipantsAccountIDsForDisplay(report, undefined, true, true, reportMetadata);
const moneyRequestOptions = temporary_getMoneyRequestOptions(report, policy, participantAccountIDs, betas, isReportArchived, isRestrictedToPreferredPolicy);
const policyName = getPolicyName({report});
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();

const filteredOptions = moneyRequestOptions.filter(
(
Expand Down Expand Up @@ -127,6 +129,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) {
shouldShowUsePlusButtonText,
additionalText,
isTrackIntentUser: !!isTrackIntentUser,
currentUserAccountID,
});

return (
Expand Down
8 changes: 7 additions & 1 deletion src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ type WelcomeMessageParams = {
shouldShowUsePlusButtonText?: boolean;
additionalText?: string;
isTrackIntentUser?: boolean;
currentUserAccountID?: number;
};

function compareStringDates(a: string, b: string): 0 | 1 | -1 {
Expand Down Expand Up @@ -697,6 +698,7 @@ function getOptionData({
reportAttributesDerived,
policyTags,
currentUserLogin,
isTrackIntentUser,
}: {
report: OnyxEntry<Report>;
oneTransactionThreadReport: OnyxEntry<Report>;
Expand All @@ -721,6 +723,7 @@ function getOptionData({
reportAttributesDerived?: ReportAttributesDerivedValue['reports'];
policyTags?: OnyxEntry<PolicyTagLists>;
currentUserLogin: string;
isTrackIntentUser?: boolean;
}): OptionData | undefined {
// When a user signs out, Onyx is cleared. Due to the lazy rendering with a virtual list, it's possible for
// this method to be called after the Onyx data has been cleared out. In that case, it's fine to do
Expand Down Expand Up @@ -1164,6 +1167,8 @@ function getOptionData({
conciergeReportID,
reportAttributes: reportAttributesDerived,
isReportArchived,
isTrackIntentUser,
currentUserAccountID,
}).messageText ?? translate('report.noActivityYet'),
);
}
Expand Down Expand Up @@ -1270,6 +1275,7 @@ function getWelcomeMessage(params: WelcomeMessageParams): WelcomeMessage {
shouldShowUsePlusButtonText = false,
additionalText = '',
isTrackIntentUser = false,
currentUserAccountID,
} = params;

const welcomeMessage: WelcomeMessage = {};
Expand All @@ -1285,7 +1291,7 @@ function getWelcomeMessage(params: WelcomeMessageParams): WelcomeMessage {
if (policy?.description) {
welcomeMessage.messageHtml = policy.description;
welcomeMessage.messageText = Parser.htmlToText(welcomeMessage.messageHtml);
} else if (isTrackIntentUser) {
} else if (isTrackIntentUser && report?.ownerAccountID === currentUserAccountID) {
welcomeMessage.messageHtml = translate('reportActionsView.beginningOfChatHistoryPolicyExpenseChatTrack');
welcomeMessage.messageText = Parser.htmlToText(welcomeMessage.messageHtml);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {hasSeenTourSelector} from '@selectors/Onboarding';
import {hasSeenTourSelector, isTrackIntentUserSelector} from '@selectors/Onboarding';
import {deepEqual} from 'fast-equals';
import type {RefObject} from 'react';
import React, {memo, useMemo, useRef, useState} from 'react';
Expand Down Expand Up @@ -241,6 +241,7 @@ function BaseReportActionContextMenu({
const {transactions} = useTransactionsAndViolationsForReport(childReport?.reportID);
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [isTrackIntentUser] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {selector: isTrackIntentUserSelector});
const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector});
const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
Expand Down Expand Up @@ -396,6 +397,7 @@ function BaseReportActionContextMenu({
card,
originalReport,
isTryNewDotNVPDismissed,
isTrackIntentUser,
childReport,
movedFromReport,
movedToReport,
Expand Down
10 changes: 8 additions & 2 deletions src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {formatPhoneNumber as formatPhoneNumberPhoneUtils} from '@libs/LocalePhon
import {getForReportAction} from '@libs/ModifiedExpenseMessage';
import Navigation from '@libs/Navigation/Navigation';
import Parser from '@libs/Parser';
import {getCleanedTagName, isPolicyAdmin} from '@libs/PolicyUtils';
import {getCleanedTagName, isPolicyAdmin, isSubmitAndClose} from '@libs/PolicyUtils';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import stripFollowupListFromHtml from '@libs/ReportActionFollowupUtils/stripFollowupListFromHtml';
import {
Expand Down Expand Up @@ -289,6 +289,7 @@ type ContextMenuActionPayload = {
originalReport: OnyxEntry<ReportType>;
isHarvestReport?: boolean;
isTryNewDotNVPDismissed?: boolean;
isTrackIntentUser?: boolean;
childReport?: OnyxEntry<ReportType>;
movedFromReport?: OnyxEntry<ReportType>;
movedToReport?: OnyxEntry<ReportType>;
Expand Down Expand Up @@ -797,6 +798,7 @@ const ContextMenuActions: ContextMenuAction[] = [
originalReport,
isHarvestReport,
isTryNewDotNVPDismissed,
isTrackIntentUser,
movedFromReport,
movedToReport,
childReport,
Expand Down Expand Up @@ -982,7 +984,11 @@ const ContextMenuActions: ContextMenuAction[] = [
if (harvesting) {
setClipboardMessage(translate('iou.automaticallySubmitted'));
} else {
Clipboard.setString(translate('iou.submitted', getOriginalMessage(reportAction)?.message));
Clipboard.setString(
isTrackIntentUser && isSubmitAndClose(policy)
? translate('iou.markedAsDone', getOriginalMessage(reportAction)?.message)
: translate('iou.submitted', getOriginalMessage(reportAction)?.message),
);
}
} else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED)) {
const {automaticAction} = getOriginalMessage(reportAction) ?? {};
Expand Down
Loading