Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a29ca96
add files
Gonals Jun 24, 2026
420b7a2
better rule building
Gonals Jun 26, 2026
df701b6
better edition handling
Gonals Jun 26, 2026
f121f2c
better handling of rule generation
Gonals Jun 26, 2026
9885609
conflicts
Gonals Jun 29, 2026
9602c86
some cleanup
Gonals Jun 29, 2026
0af1aa7
rename helper functions
Gonals Jun 29, 2026
6a1eadc
better naming
Gonals Jun 29, 2026
ae82565
some more naming/doc changes
Gonals Jun 29, 2026
9973de0
some more cleanup
Gonals Jun 29, 2026
9a1199b
prettier
Gonals Jun 29, 2026
4b5c3e2
knip
Gonals Jun 29, 2026
dcfe92c
lint
Gonals Jun 29, 2026
70b4043
more lint
Gonals Jun 29, 2026
26c2ffa
Merge branch 'main' into alberto-moreApprovers
Gonals Jun 29, 2026
437c9e4
more lint
Gonals Jun 29, 2026
2beaf40
Merge branch 'main' into alberto-moreApprovers
Gonals Jun 29, 2026
3cce08e
lint again
Gonals Jun 29, 2026
3fa8579
Add tests
Gonals Jun 29, 2026
53cbedf
prettier
Gonals Jun 29, 2026
a05bc37
type
Gonals Jun 29, 2026
2204b3e
Merge branch 'main' into alberto-moreApprovers
Gonals Jun 29, 2026
72cdcae
types
Gonals Jun 29, 2026
436b36b
conflicts
Gonals Jul 13, 2026
c785155
merge main
Gonals Jul 14, 2026
42a1bbc
handle new rules correctly
Gonals Jul 14, 2026
23d18bc
properly group people in the same rules
Gonals Jul 14, 2026
9213ee2
big cleanup
Gonals Jul 14, 2026
d14a197
comment cleanup
Gonals Jul 15, 2026
0ea1d6a
better comparison
Gonals Jul 15, 2026
d28316f
general cleanup
Gonals Jul 15, 2026
3d449ed
renaming
Gonals Jul 15, 2026
ea1de10
small refactor
Gonals Jul 15, 2026
f879ada
Add missing file
Gonals Jul 15, 2026
9c651e0
knip
Gonals Jul 15, 2026
ee13b8c
fix test
Gonals Jul 15, 2026
d9602ca
we gotta do this
Gonals Jul 15, 2026
51d0af1
new rules project
Gonals Jul 15, 2026
dfa0c1c
rule handling fix
Gonals Jul 15, 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
2 changes: 1 addition & 1 deletion config/eslint/eslint.seatbelt.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@
"../../tests/unit/VideoRendererTest.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../tests/unit/ViolationUtilsTest.ts" "@typescript-eslint/no-unsafe-type-assertion" 20
"../../tests/unit/WhisperContentMentionContextTest.tsx" "@typescript-eslint/no-unsafe-type-assertion" 3
"../../tests/unit/WorkflowUtilsTest.ts" "@typescript-eslint/no-unsafe-type-assertion" 7
"../../tests/unit/WorkflowUtilsTest.ts" "@typescript-eslint/no-unsafe-type-assertion" 8
"../../tests/unit/WorkspaceReportFieldUtilsTest.ts" "@typescript-eslint/no-unsafe-type-assertion" 2
"../../tests/unit/WorkspacesSettingsUtilsTest.ts" "@typescript-eslint/no-unsafe-type-assertion" 23
"../../tests/unit/awaitStagingDeploysTest.ts" "@typescript-eslint/no-unsafe-type-assertion" 3
Expand Down
22 changes: 22 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ const CONST = {
RILLET: 'rillet',
RULES_REVAMP: 'rulesRevamp',
COMMUTER_EXCLUSIONS: 'commuterExclusions',
MULTIPLE_APPROVERS: 'multipleApprovers',
DEFAULT_LETTER_AVATARS: 'defaultLetterAvatars',
},
BUTTON_STATES: {
Expand Down Expand Up @@ -7798,6 +7799,27 @@ const CONST = {
},
},

/** Vocabulary for the AST-based rules stored in the `rules` table / `ONYXKEYS.COLLECTION.RULE`. */
RULES: {
/** The kind of entity a rule is scoped to. Currently only workspace policies. Shared across all rule types. */
SCOPE: {
POLICY: 'policy',
},
/** Vocabulary specific to approval-workflow rules. */
APPROVAL_WORKFLOW: {
/** The report lifecycle event that fires a rule. */
TRIGGER: {
REPORT_SUBMIT: 'ReportSubmit',
REPORT_APPROVE: 'ReportApprove',
},
/** The action taken when a rule matches. */
ACTION: {
FORWARD_TO: 'ForwardTo',
APPROVE_REPORT: 'ApproveReport',
},
},
},

BOOT_SPLASH_STATE: {
VISIBLE: 'visible',
READY_TO_BE_HIDDEN: 'readyToBeHidden',
Expand Down
4 changes: 4 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,9 @@ const ONYXKEYS = {
POLICY_HAS_CONNECTIONS_DATA_BEEN_FETCHED: 'policyHasConnectionsDataBeenFetched_',
POLICY_CONNECTION_SYNC_PROGRESS: 'policyConnectionSyncProgress_',
POLICY_MERGE_HR_INITIAL_SYNC_MODAL_SHOWN: 'policyMergeHRInitialSyncModalShown_',
// AST rules keyed by ruleID (`rules_<ruleID>`). Mirrors a row of the server `rules` table.
// Currently holds approval-workflow rules; intended for all AST rules in the future.
RULE: 'rules_',
WORKSPACE_INVITE_MEMBERS_DRAFT: 'workspaceInviteMembersDraft_',
WORKSPACE_INVITE_MESSAGE_DRAFT: 'workspaceInviteMessageDraft_',
WORKSPACE_INVITE_ROLE_DRAFT: 'workspaceInviteRoleDraft_',
Expand Down Expand Up @@ -1389,6 +1392,7 @@ type OnyxCollectionValuesMapping = {
[ONYXKEYS.COLLECTION.EXPORT_DOWNLOAD]: OnyxTypes.ExportDownload;
[ONYXKEYS.COLLECTION.POLICY]: OnyxTypes.Policy;
[ONYXKEYS.COLLECTION.POLICY_DRAFTS]: OnyxTypes.Policy;
[ONYXKEYS.COLLECTION.RULE]: OnyxTypes.Rule;
[ONYXKEYS.COLLECTION.POLICY_CATEGORIES]: OnyxTypes.PolicyCategories;
[ONYXKEYS.COLLECTION.POLICY_CATEGORIES_DRAFT]: OnyxTypes.PolicyCategories;
[ONYXKEYS.COLLECTION.POLICY_TAGS]: OnyxTypes.PolicyTagLists;
Expand Down
3 changes: 2 additions & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2455,7 +2455,8 @@ const ROUTES = {
},
WORKSPACE_WORKFLOWS_APPROVALS_EDIT: {
route: 'workspaces/:policyID/workflows/approvals/:firstApproverEmail/edit',
getRoute: (policyID: string, firstApproverEmail: string) => `workspaces/${policyID}/workflows/approvals/${encodeURIComponent(firstApproverEmail)}/edit` as const,
getRoute: (policyID: string, firstApproverEmail: string, memberEmail?: string) =>
`workspaces/${policyID}/workflows/approvals/${encodeURIComponent(firstApproverEmail)}/edit${memberEmail ? `?memberEmail=${encodeURIComponent(memberEmail)}` : ''}` as const,
Comment thread
Gonals marked this conversation as resolved.
},
WORKSPACE_WORKFLOWS_APPROVALS_APPROVER: {
route: 'workspaces/:policyID/workflows/approvals/approver',
Expand Down
11 changes: 11 additions & 0 deletions src/libs/API/parameters/SetApprovalWorkflowParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type SetApprovalWorkflowParams = {
/** The policy ID whose approval-workflow rules are being mutated. */
policyID: string;

/**
* JSON-stringified object keyed by ruleID
*/
rules: string;
};

export default SetApprovalWorkflowParams;
Comment thread
Gonals marked this conversation as resolved.
1 change: 1 addition & 0 deletions src/libs/API/parameters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ export type {default as DeleteDomainParams} from './DeleteDomainParams';
export type {default as GetDuplicateTransactionDetailsParams} from './GetDuplicateTransactionDetailsParams';
export type {default as SetPolicyCategoryReceiptsAndItemizedReceiptRequiredParams} from './SetPolicyCategoryReceiptsAndItemizedReceiptRequiredParams';
export type {default as SetPolicyCodingRuleParams} from './SetPolicyCodingRuleParams';
export type {default as SetApprovalWorkflowParams} from './SetApprovalWorkflowParams';
export type {default as RegisterAuthenticationKeyParams} from './RegisterAuthenticationKeyParams';
export type {default as RevokeMultifactorAuthenticationCredentialsParams} from './RevokeMultifactorAuthenticationCredentialsParams';
export type {default as TroubleshootMultifactorAuthenticationParams} from './TroubleshootMultifactorAuthenticationParams';
Expand Down
2 changes: 2 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ const WRITE_COMMANDS = {
SET_POLICY_TIME_TRACKING_DEFAULT_RATE: 'SetPolicyTimeTrackingDefaultRate',
SET_POLICY_RULES_ENABLED: 'SetPolicyRulesEnabled',
SET_POLICY_CODING_RULE: 'SetPolicyCodingRule',
SET_APPROVAL_WORKFLOW: 'SetApprovalWorkflow',
SET_POLICY_EXPENSE_MAX_AMOUNT_NO_RECEIPT: 'SetPolicyExpenseMaxAmountNoReceipt',
SET_POLICY_EXPENSE_MAX_AMOUNT_NO_ITEMIZED_RECEIPT: 'SetPolicyExpenseMaxAmountNoItemizedReceipt',
SET_POLICY_EXPENSE_MAX_AMOUNT: 'SetPolicyExpenseMaxAmount',
Expand Down Expand Up @@ -929,6 +930,7 @@ type WriteCommandParameters = {
[WRITE_COMMANDS.ENABLE_POLICY_TIME_TRACKING]: Parameters.EnablePolicyTimeTrackingParams;
[WRITE_COMMANDS.SET_POLICY_RULES_ENABLED]: Parameters.SetPolicyRulesEnabledParams;
[WRITE_COMMANDS.SET_POLICY_CODING_RULE]: Parameters.SetPolicyCodingRuleParams;
[WRITE_COMMANDS.SET_APPROVAL_WORKFLOW]: Parameters.SetApprovalWorkflowParams;
[WRITE_COMMANDS.SET_POLICY_REQUIRE_COMPANY_CARDS_ENABLED]: Parameters.SetPolicyRequireCompanyCardsEnabledParams;
[WRITE_COMMANDS.SET_POLICY_CATEGORY_DESCRIPTION_REQUIRED]: Parameters.SetPolicyCategoryDescriptionRequiredParams;
[WRITE_COMMANDS.SET_POLICY_CATEGORY_ATTENDEES_REQUIRED]: Parameters.SetPolicyCategoryAttendeesRequiredParams;
Expand Down
1 change: 1 addition & 0 deletions src/libs/ExportOnyxState/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ const onyxKeysToMaskFragileData = new Set<string>([
ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT,
ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS,
ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING,
ONYXKEYS.COLLECTION.RULE,
ONYXKEYS.COLLECTION.SAML_METADATA,
ONYXKEYS.COLLECTION.SECURITY_GROUP,
ONYXKEYS.COLLECTION.SHARED_NVP_AGENT_PROMPT,
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2844,6 +2844,7 @@ type WorkspaceSplitNavigatorParamList = {
[SCREENS.WORKSPACE.WORKFLOWS_APPROVALS_EDIT]: {
policyID: string;
firstApproverEmail: string;
memberEmail?: string;
};
[SCREENS.WORKSPACE.DYNAMIC_WORKFLOWS_APPROVALS_EXPENSES_FROM]: {
policyID: string;
Expand Down
Loading
Loading