Skip to content
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 "submitted by harvesting" report action copy #48939

Merged
merged 20 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
baf36ec
Add optional harvesting key for delayed auto submit
Beamanator Sep 10, 2024
a019fe1
A few new consts for help sites
Beamanator Sep 10, 2024
292c0a9
New function for building automatically submitted report message
Beamanator Sep 10, 2024
c690569
Conditionally show type of submitted message
Beamanator Sep 10, 2024
4181193
Add in translations
Beamanator Sep 10, 2024
a307b5e
Fix type issues
Beamanator Sep 10, 2024
68eb6a5
Style fixes
Beamanator Sep 10, 2024
d85051d
Merge branch 'main' of github.com:Expensify/App into beaman-updateSub…
Beamanator Sep 10, 2024
bf23be5
Merge branch 'main' of github.com:Expensify/App into beaman-updateSub…
Beamanator Sep 11, 2024
2992186
Merge branch 'main' of github.com:Expensify/App into beaman-updateSub…
Beamanator Sep 12, 2024
8b6d355
Update src/languages/es.ts
Beamanator Sep 17, 2024
3afaa62
Merge branch 'main' of github.com:Expensify/App into beaman-updateSub…
Beamanator Sep 20, 2024
efb41e6
Merge branch 'beaman-updateSubmittedByHarvestingCopy' of github.com:E…
Beamanator Sep 20, 2024
e7523d9
Get user wallet with useOnyx
Beamanator Sep 20, 2024
c077731
Fix getting wallet from onyx
Beamanator Sep 20, 2024
63679a1
UseOnyx to get emoji reactions
Beamanator Sep 20, 2024
5a1d6e4
Move linked transaction route error for useOnyx
Beamanator Sep 20, 2024
140f1dc
Get iouReport with useOnyx
Beamanator Sep 20, 2024
0bde076
Prettify, remove withOnyx import
Beamanator Sep 20, 2024
80d0909
Merge branch 'main' of github.com:Expensify/App into beaman-updateSub…
Beamanator Sep 25, 2024
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
2 changes: 2 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,9 @@ const CONST = {
PRICING: `https://www.expensify.com/pricing`,
COMPANY_CARDS_HELP: 'https://help.expensify.com/articles/expensify-classic/connect-credit-cards/company-cards/Commercial-Card-Feeds',
CUSTOM_REPORT_NAME_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/spending-insights/Custom-Templates',
CONFIGURE_REIMBURSEMENT_SETTINGS_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/workspaces/Configure-Reimbursement-Settings',
COPILOT_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/copilots-and-delegates/Assign-or-remove-a-Copilot',
DELAYED_SUBMISSION_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/reports/Automatically-submit-employee-reports',
// Use Environment.getEnvironmentURL to get the complete URL with port number
DEV_NEW_EXPENSIFY_URL: 'https://dev.new.expensify.com:',
OLDDOT_URLS: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,8 @@ export default {
sendInvoice: ({amount}: RequestAmountParams) => `Send ${amount} invoice`,
submitAmount: ({amount}: RequestAmountParams) => `submit ${amount}`,
submittedAmount: ({formattedAmount, comment}: RequestedAmountMessageParams) => `submitted ${formattedAmount}${comment ? ` for ${comment}` : ''}`,
automaticallySubmittedAmount: ({formattedAmount}: RequestedAmountMessageParams) =>
`automatically submitted ${formattedAmount} via <a href="${CONST.DELAYED_SUBMISSION_HELP_URL}">delayed submission</a>`,
trackedAmount: ({formattedAmount, comment}: RequestedAmountMessageParams) => `tracking ${formattedAmount}${comment ? ` for ${comment}` : ''}`,
splitAmount: ({amount}: SplitAmountParams) => `split ${amount}`,
didSplitAmount: ({formattedAmount, comment}: DidSplitAmountMessageParams) => `split ${formattedAmount}${comment ? ` for ${comment}` : ''}`,
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,8 @@ export default {
sendInvoice: ({amount}: RequestAmountParams) => `Enviar factura de ${amount}`,
submitAmount: ({amount}: RequestAmountParams) => `solicitar ${amount}`,
submittedAmount: ({formattedAmount, comment}: RequestedAmountMessageParams) => `solicitó ${formattedAmount}${comment ? ` para ${comment}` : ''}`,
automaticallySubmittedAmount: ({formattedAmount}: RequestedAmountMessageParams) =>
`se enviaron automáticamente ${formattedAmount} mediante <a href="${CONST.DELAYED_SUBMISSION_HELP_URL}">envío diferido</a>`,
trackedAmount: ({formattedAmount, comment}: RequestedAmountMessageParams) => `realizó un seguimiento de ${formattedAmount}${comment ? ` para ${comment}` : ''}`,
splitAmount: ({amount}: SplitAmountParams) => `dividir ${amount}`,
didSplitAmount: ({formattedAmount, comment}: DidSplitAmountMessageParams) => `dividió ${formattedAmount}${comment ? ` para ${comment}` : ''}`,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails
lastMessageTextFromReport = ReportUtils.formatReportLastMessageText(TaskUtils.getTaskReportActionMessage(lastReportAction).text);
} else if (ReportActionUtils.isCreatedTaskReportAction(lastReportAction)) {
lastMessageTextFromReport = TaskUtils.getTaskCreatedMessage(lastReportAction);
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.SUBMITTED) {
} else if (ReportActionUtils.isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED)) {
lastMessageTextFromReport = ReportUtils.getIOUSubmittedMessage(lastReportAction);
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) {
lastMessageTextFromReport = ReportUtils.getIOUApprovedMessage(lastReportAction);
Expand Down
9 changes: 7 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3713,7 +3713,7 @@ function getReportName(
}
const parentReportActionMessage = ReportActionsUtils.getReportActionMessage(parentReportAction);

if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.SUBMITTED) {
if (ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED)) {
return getIOUSubmittedMessage(parentReportAction);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm same here??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep - create a thread off of this auto-submitted action, you'll see the report name is the old text

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing in #49909

}
if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) {
Expand Down Expand Up @@ -4448,7 +4448,11 @@ function getFormattedAmount(reportAction: ReportAction) {
return formattedAmount;
}

function getIOUSubmittedMessage(reportAction: ReportAction) {
function getReportAutomaticallySubmittedMessage(reportAction: ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.SUBMITTED>) {
return Localize.translateLocal('iou.automaticallySubmittedAmount', {formattedAmount: getFormattedAmount(reportAction)});
}

function getIOUSubmittedMessage(reportAction: ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.SUBMITTED>) {
return Localize.translateLocal('iou.submittedAmount', {formattedAmount: getFormattedAmount(reportAction)});
}

Expand Down Expand Up @@ -7917,6 +7921,7 @@ export {
getIOUForwardedMessage,
getRejectedReportMessage,
getWorkspaceNameUpdatedMessage,
getReportAutomaticallySubmittedMessage,
getIOUSubmittedMessage,
getIcons,
getIconsForParticipants,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ const ContextMenuActions: ContextMenuAction[] = [
setClipboardMessage(CONST.ACTIONABLE_TRACK_EXPENSE_WHISPER_MESSAGE);
} else if (ReportActionsUtils.isRenamedAction(reportAction)) {
setClipboardMessage(ReportActionsUtils.getRenamedAction(reportAction));
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.SUBMITTED) {
} else if (ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I might need to update this to copy the "automatically..." text, not just "submitted..." 🙃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing in #49909

const displayMessage = ReportUtils.getIOUSubmittedMessage(reportAction);
Clipboard.setString(displayMessage);
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) {
Expand Down
13 changes: 11 additions & 2 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,17 @@ function ReportActionItem({
children = <ReportActionItemBasicMessage message={ReportUtils.getReimbursementDeQueuedActionMessage(action, report)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIED_EXPENSE) {
children = <ReportActionItemBasicMessage message={ModifiedExpenseMessage.getForReportAction(reportID, action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.SUBMITTED) {
children = <ReportActionItemBasicMessage message={ReportUtils.getIOUSubmittedMessage(action)} />;
} else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.SUBMITTED)) {
const wasSubmittedViaHarvesting = ReportActionsUtils.getOriginalMessage(action)?.harvesting ?? false;
if (wasSubmittedViaHarvesting) {
children = (
<ReportActionItemBasicMessage message="">
<RenderHTML html={`<comment><muted-text>${ReportUtils.getReportAutomaticallySubmittedMessage(action)}</muted-text></comment>`} />
</ReportActionItemBasicMessage>
);
} else {
children = <ReportActionItemBasicMessage message={ReportUtils.getIOUSubmittedMessage(action)} />;
}
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) {
children = <ReportActionItemBasicMessage message={ReportUtils.getIOUApprovedMessage(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) {
Expand Down
3 changes: 3 additions & 0 deletions src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ type OriginalMessageSubmitted = {

/** Report ID of the expense */
expenseReportID: string;

/** Was the report submitted via harvesting (delayed submit) */
harvesting?: boolean;
};

/** Model of `closed` report action */
Expand Down
Loading