Skip to content
Merged
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
5 changes: 5 additions & 0 deletions src/components/FeatureList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ type FeatureListProps = {

/** Custom content to display in the footer */
footer?: ReactNode;

/** Whether the button should be disabled */
isButtonDisabled?: boolean;
};

function FeatureList({
Expand All @@ -72,6 +75,7 @@ function FeatureList({
titleStyles,
contentPaddingOnLargeScreens,
footer,
isButtonDisabled = false,
}: FeatureListProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand Down Expand Up @@ -117,6 +121,7 @@ function FeatureList({
accessibilityLabel={ctaAccessibilityLabel}
style={styles.w100}
success
isDisabled={isButtonDisabled}
large
/>
)}
Expand Down
8 changes: 8 additions & 0 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1731,6 +1731,8 @@ function createDraftInitialWorkspace(policyOwnerEmail = '', policyName = '', pol
ownerAccountID: sessionAccountID,
isPolicyExpenseChatEnabled: true,
areCategoriesEnabled: true,
areCompanyCardsEnabled: true,
areExpensifyCardsEnabled: false,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

All of these are TEAM only, you cannot create Control policy in NewDot now. Lets be explicit about the Expensify card settings too

outputCurrency,
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
customUnits,
Expand Down Expand Up @@ -1836,11 +1838,13 @@ function buildPolicyData(
},
customUnits,
areCategoriesEnabled: true,
areCompanyCardsEnabled: true,
areTagsEnabled: false,
areDistanceRatesEnabled: false,
areWorkflowsEnabled: shouldEnableWorkflowsByDefault,
areReportFieldsEnabled: false,
areConnectionsEnabled: false,
areExpensifyCardsEnabled: false,
employeeList: {
[sessionEmail]: {
role: CONST.POLICY.ROLE.ADMIN,
Expand Down Expand Up @@ -2167,11 +2171,13 @@ function createDraftWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policy
},
customUnits,
areCategoriesEnabled: true,
areCompanyCardsEnabled: true,
areTagsEnabled: false,
areDistanceRatesEnabled: false,
areWorkflowsEnabled: false,
areReportFieldsEnabled: false,
areConnectionsEnabled: false,
areExpensifyCardsEnabled: false,
employeeList: {
[sessionEmail]: {
role: CONST.POLICY.ROLE.ADMIN,
Expand Down Expand Up @@ -2480,11 +2486,13 @@ function createWorkspaceFromIOUPayment(iouReport: OnyxEntry<Report>): WorkspaceF
},
customUnits,
areCategoriesEnabled: true,
areCompanyCardsEnabled: true,
areTagsEnabled: false,
areDistanceRatesEnabled: false,
areWorkflowsEnabled: false,
areReportFieldsEnabled: false,
areConnectionsEnabled: false,
areExpensifyCardsEnabled: false,
employeeList: {
[sessionEmail]: {
role: CONST.POLICY.ROLE.ADMIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function WorkspaceCompanyCardPageEmptyState({policy}: WithPolicyAndFullscreenLoa
const [isNoDelegateAccessMenuVisible, setIsNoDelegateAccessMenuVisible] = useState(false);
const [allWorkspaceCards] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST);
const shouldShowExpensifyCardPromotionBanner = !hasIssuedExpensifyCard(policy?.workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID, allWorkspaceCards);
const workspaceAccountID = policy?.workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is not optimistically created, so to make sure we dont allow admins to run to weird bugs we would disable the button if the workspaceAccountID does not exist


const handleCtaPress = useCallback(() => {
if (!policy?.id) {
Expand Down Expand Up @@ -70,6 +71,7 @@ function WorkspaceCompanyCardPageEmptyState({policy}: WithPolicyAndFullscreenLoa
illustrationStyle={styles.emptyStateCardIllustration}
illustrationContainerStyle={[styles.emptyStateCardIllustrationContainer, styles.justifyContentStart]}
titleStyles={styles.textHeadlineH1}
isButtonDisabled={workspaceAccountID > CONST.DEFAULT_NUMBER_ID}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should be the opposite, right? this disables it IF workspaceAccountID exists, not if it doesn't.

The comment above seems to suggest that this is backwards.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

#58670 if so

/>
<DelegateNoAccessModal
isNoDelegateAccessMenuVisible={isNoDelegateAccessMenuVisible}
Expand Down