-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Labels
ExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributorNewFeatureSomething to build that is a new item.Something to build that is a new item.ReviewingHas a PR in reviewHas a PR in reviewWeeklyKSv2KSv2
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Expected Result:
- Go to workspaces page
- Press the
...menu on a workspace - Press Duplicate Workspace
- Enter the workspace name
- Press Next
- On this screen there should be a new checkbox to copy "Merchant Rules" under the checkbox for "Rules"
- The subtitle of that checkbox should be "N merchant rules" where N is the number of merchant coding rules
- Press Continue
- Press Proceed on the dialog
- Ensure the workspace was duplicated
- If the Merchant Rules checkbox was selected, and there are merchant coding rules in the original workspace, the merchant rules should be present in the new workspace
- If the Merchant Rules checkbox was selected, and there are no merchant coding rules in the original workspace, or if the Merchant Rules checkbox was not selected, there should be no merchant coding rules in the new workspace
Here are the steps Cursor suggested - note that this will require backend changes for it to work
- Add translation strings
In src/languages/en.ts, add to the duplicateWorkspace section (around line 5485):
duplicateWorkspace: {
// ... existing keys ...
merchantRules: 'Merchant rules',
merchantRulesCount: ({count}: {count: number}) => `${count} merchant ${count === 1 ? 'rule' : 'rules'}`,
},Add corresponding translations in all other language files (es.ts, fr.ts, de.ts, it.ts, ja.ts, nl.ts, pl.ts, pt-BR.ts, zh-hans.ts).
- Update WorkspaceDuplicateSelectFeaturesForm.tsx
In src/pages/workspace/duplicate/WorkspaceDuplicateSelectFeaturesForm.tsx
a) Import isEmptyObject if not already imported:
import {isEmptyObject} from '@src/types/utils/EmptyObject';b) Add a variable to count coding rules (around line 56):
const codingRulesCount = Object.keys(policy?.rules?.codingRules ?? {}).length;c) Add a new item to the items array (around line 136, after the rules item):
codingRulesCount > 0 && !isCollect
? {
translation: translate('workspace.duplicateWorkspace.merchantRules'),
value: 'codingRules',
alternateText: translate('workspace.duplicateWorkspace.merchantRulesCount', {count: codingRulesCount}),
}
: undefined,d) Update the parts object in confirmDuplicate (around line 223) to add the new key:
parts: {
// ... existing parts ...
codingRules: selectedItems.includes('codingRules'),
},e) Add codingRulesCount to the dependencies array of items useMemo (around line 186).
Screenshots/Videos
cc @JmillsExpensify @JS00001 @luacmartins
Issue Owner
Current Issue Owner: @Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022019136503061610055
- Upwork Job ID: 2019136503061610055
- Last Price Increase: 2026-02-04
- Automatic offers:
- situchan | Reviewer | 110349053
Issue Owner
Current Issue Owner: @Reactions are currently unavailable
Metadata
Metadata
Labels
ExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributorNewFeatureSomething to build that is a new item.Something to build that is a new item.ReviewingHas a PR in reviewHas a PR in reviewWeeklyKSv2KSv2