-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Show concierge system message after submit/approval action #77638
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
Merged
francoisl
merged 20 commits into
Expensify:main
from
bernhardoj:fix/75223-dew-system-msg-after-submit/approvel
Dec 21, 2025
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
997027d
show concierge system message after submit/approval action
bernhardoj a0a912a
remove log
bernhardoj 7ef0b5c
add missing param
bernhardoj baf7310
Merge branch 'main' into fix/75223-dew-system-msg-after-submit/approvel
bernhardoj fb158b8
lint
bernhardoj e62b28f
Merge branch 'main' into fix/75223-dew-system-msg-after-submit/approvel
bernhardoj 11ef3ee
lint
bernhardoj a0a97f8
Merge branch 'main' into fix/75223-dew-system-msg-after-submit/approvel
bernhardoj a5304d6
fix type
bernhardoj d63ff11
Merge branch 'main' into fix/75223-dew-system-msg-after-submit/approvel
bernhardoj d826503
fix dew routed action detail is missing
bernhardoj c5d3751
don't show dew routed action until the report is submitted
bernhardoj 3c87f0e
add test
bernhardoj ff91890
lint
bernhardoj f8ef16b
Merge branch 'main' into fix/75223-dew-system-msg-after-submit/approvel
bernhardoj 80d8218
fix test
bernhardoj 0aa8352
use getSortedReportActions back and apply withDEWRoutedActionsArray t…
bernhardoj 370ba64
Merge branch 'main' into fix/75223-dew-system-msg-after-submit/approvel
bernhardoj 7959987
make workflow type optional
bernhardoj 191600f
Merge branch 'main' into fix/75223-dew-system-msg-after-submit/approvel
bernhardoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| import {isCardPendingActivate} from './CardUtils'; | ||
| import {getDecodedCategoryName} from './CategoryUtils'; | ||
| import {convertAmountToDisplayString, convertToDisplayString, convertToShortDisplayString} from './CurrencyUtils'; | ||
| import DateUtils from './DateUtils'; | ||
| import {getEnvironmentURL, getOldDotEnvironmentURL} from './Environment/Environment'; | ||
| import getBase62ReportID from './getBase62ReportID'; | ||
| import {isReportMessageAttachment} from './isReportMessageAttachment'; | ||
|
|
@@ -59,7 +60,7 @@ | |
| type MemberChangeMessageElement = MessageTextElement | MemberChangeMessageUserMentionElement | MemberChangeMessageRoomReferenceElement; | ||
|
|
||
| let allReportActions: OnyxCollection<ReportActions>; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, | ||
| waitForCollectionCallback: true, | ||
| callback: (actions) => { | ||
|
|
@@ -224,6 +225,10 @@ | |
| return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED_AND_CLOSED); | ||
| } | ||
|
|
||
| function isDynamicExternalWorkflowSubmitAction(reportAction: OnyxInputOrEntry<ReportAction>): reportAction is ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.SUBMITTED> { | ||
| return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED) && getOriginalMessage(reportAction)?.workflow === CONST.POLICY.APPROVAL_MODE.DYNAMICEXTERNAL; | ||
| } | ||
|
|
||
| function isMarkAsClosedAction(reportAction: OnyxInputOrEntry<ReportAction>): reportAction is ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.CLOSED> { | ||
| return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.CLOSED) && !!getOriginalMessage(reportAction)?.amount; | ||
| } | ||
|
|
@@ -240,6 +245,10 @@ | |
| return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.FORWARDED); | ||
| } | ||
|
|
||
| function isDynamicExternalWorkflowForwardedAction(reportAction: OnyxInputOrEntry<ReportAction>): reportAction is ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED> { | ||
| return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.FORWARDED) && getOriginalMessage(reportAction)?.workflow === CONST.POLICY.APPROVAL_MODE.DYNAMICEXTERNAL; | ||
| } | ||
|
|
||
| function isModifiedExpenseAction(reportAction: OnyxInputOrEntry<ReportAction>): reportAction is ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.MODIFIED_EXPENSE> { | ||
| return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.MODIFIED_EXPENSE); | ||
| } | ||
|
|
@@ -1104,6 +1113,43 @@ | |
| return actions.filter(isVisiblePreviewOrMoneyRequest); | ||
| } | ||
|
|
||
| function getDynamicExternalWorkflowRoutedAction( | ||
| reportAction: ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.SUBMITTED> | ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED>, | ||
| ): ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.DYNAMIC_EXTERNAL_WORKFLOW_ROUTED> { | ||
| return { | ||
| reportActionID: `${reportAction.reportActionID}DEW`, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @francoisl is it fine that I just append DEW to the report action ID of the concierge message? This is so the ID is consistent every time |
||
| created: DateUtils.addMillisecondsFromDateTime(reportAction.created, 1), | ||
|
bernhardoj marked this conversation as resolved.
|
||
| actionName: CONST.REPORT.ACTIONS.TYPE.DYNAMIC_EXTERNAL_WORKFLOW_ROUTED, | ||
| actorAccountID: CONST.ACCOUNT_ID.CONCIERGE, | ||
| message: [{html: 'DYNAMIC_EXTERNAL_WORKFLOW', type: 'COMMENT', text: ''}], | ||
| originalMessage: { | ||
| to: getOriginalMessage(reportAction)?.to ?? '', | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| function withDEWRoutedActionsArray(reportActions: ReportAction[]): ReportAction[] { | ||
| return reportActions.flatMap((reportAction) => { | ||
| if ((isDynamicExternalWorkflowSubmitAction(reportAction) || isDynamicExternalWorkflowForwardedAction(reportAction)) && getOriginalMessage(reportAction)?.to) { | ||
| return [reportAction, getDynamicExternalWorkflowRoutedAction(reportAction)]; | ||
| } | ||
| return reportAction; | ||
| }); | ||
| } | ||
|
|
||
| function withDEWRoutedActionsObject(reportActions: OnyxEntry<ReportActions>): OnyxEntry<ReportActions> { | ||
| return Object.entries(reportActions ?? {}).reduce((acc, value) => { | ||
| const [reportActionID, reportAction] = value; | ||
| acc[reportActionID] = reportAction; | ||
|
|
||
| if ((isDynamicExternalWorkflowSubmitAction(reportAction) || isDynamicExternalWorkflowForwardedAction(reportAction)) && getOriginalMessage(reportAction)?.to) { | ||
| const dynamicExternalWorkflowRoutedAction = getDynamicExternalWorkflowRoutedAction(reportAction); | ||
| acc[dynamicExternalWorkflowRoutedAction.reportActionID] = dynamicExternalWorkflowRoutedAction; | ||
| } | ||
| return acc; | ||
| }, {} as ReportActions); | ||
| } | ||
|
|
||
| /** | ||
| * This method returns the report actions that are ready for display in the ReportActionsView. | ||
| * The report actions need to be sorted by created timestamp first, and reportActionID second | ||
|
|
@@ -1129,7 +1175,7 @@ | |
| } | ||
|
|
||
| const baseURLAdjustedReportActions = filteredReportActions.map((reportAction) => replaceBaseURLInPolicyChangeLogAction(reportAction)); | ||
| return getSortedReportActions(baseURLAdjustedReportActions, true); | ||
| return getSortedReportActions(withDEWRoutedActionsArray(baseURLAdjustedReportActions), true); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -1946,6 +1992,12 @@ | |
| return [{text: message, html: message, type: 'COMMENT'}]; | ||
| } | ||
|
|
||
| if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.DYNAMIC_EXTERNAL_WORKFLOW_ROUTED)) { | ||
| // eslint-disable-next-line @typescript-eslint/no-deprecated | ||
| const message = getDynamicExternalWorkflowRoutedMessage(action, translateLocal); | ||
| return [{text: message, html: `<muted-text>${message}</muted-text>`, type: 'COMMENT'}]; | ||
| } | ||
|
|
||
| const actionMessage = action.previousMessage ?? action.message; | ||
| if (Array.isArray(actionMessage)) { | ||
| return actionMessage.filter((item): item is Message => !!item); | ||
|
|
@@ -3291,6 +3343,13 @@ | |
| return translate('reportAction.harvestCreatedExpenseReport', {reportUrl, reportName}); | ||
| } | ||
|
|
||
| function getDynamicExternalWorkflowRoutedMessage( | ||
| action: OnyxEntry<ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.DYNAMIC_EXTERNAL_WORKFLOW_ROUTED>>, | ||
| translate: LocaleContextProps['translate'], | ||
| ) { | ||
| return translate('iou.routedDueToDEW', {to: getOriginalMessage(action)?.to ?? ''}); | ||
|
bernhardoj marked this conversation as resolved.
|
||
| } | ||
|
|
||
| function isCardIssuedAction( | ||
| reportAction: OnyxEntry<ReportAction>, | ||
| ): reportAction is ReportAction< | ||
|
|
@@ -3531,6 +3590,7 @@ | |
| getUpdatedApprovalRuleMessage, | ||
| getRemovedFromApprovalChainMessage, | ||
| getDemotedFromWorkspaceMessage, | ||
| getDynamicExternalWorkflowRoutedMessage, | ||
| getReportAction, | ||
| getReportActionHtml, | ||
| getReportActionMessage, | ||
|
|
@@ -3604,8 +3664,10 @@ | |
| isWhisperAction, | ||
| isSubmittedAction, | ||
| isSubmittedAndClosedAction, | ||
| isDynamicExternalWorkflowSubmitAction, | ||
| isMarkAsClosedAction, | ||
| isApprovedAction, | ||
| isDynamicExternalWorkflowForwardedAction, | ||
| isUnapprovedAction, | ||
| isForwardedAction, | ||
| isWhisperActionTargetedToOthers, | ||
|
|
@@ -3690,6 +3752,8 @@ | |
| getActionableCardFraudAlertMessage, | ||
| getHarvestCreatedExpenseReportMessage, | ||
| isSystemUserMentioned, | ||
| withDEWRoutedActionsArray, | ||
| withDEWRoutedActionsObject, | ||
| }; | ||
|
|
||
| export type {LastVisibleMessage}; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.