Skip to content

fix: Hide Accounts settings and skip SYNC_EMAIL onboarding when CONNECTED_ACCOUNTS permission is disabled#17606

Open
njg7194 wants to merge 1 commit intotwentyhq:mainfrom
njg7194:fix/connected-accounts-permission-onboarding
Open

fix: Hide Accounts settings and skip SYNC_EMAIL onboarding when CONNECTED_ACCOUNTS permission is disabled#17606
njg7194 wants to merge 1 commit intotwentyhq:mainfrom
njg7194:fix/connected-accounts-permission-onboarding

Conversation

@njg7194
Copy link

@njg7194 njg7194 commented Feb 1, 2026

Summary

Fixes #17411

When CONNECTED_ACCOUNTS permission is disabled for a role, users were still seeing:

  1. The "Emails and Calendar" onboarding step (SYNC_EMAIL)
  2. The Settings > Accounts navigation item

This creates a confusing UX where users are prompted to do something their role doesn't permit.

Changes

Frontend

  1. Settings Navigation (useSettingsNavigationItems.tsx):

    • Added isHidden: !permissionMap[PermissionFlagType.CONNECTED_ACCOUNTS] to the Accounts navigation item
    • Users without CONNECTED_ACCOUNTS permission will no longer see the Accounts section in Settings
  2. Onboarding Flow (useSetNextOnboardingStatus.ts):

    • Added permission check using usePermissionFlagMap
    • When CONNECTED_ACCOUNTS permission is disabled, the SYNC_EMAIL step is skipped
    • Users go directly from PROFILE_CREATION to INVITE_TEAM

Tests

  • Updated useSetNextOnboardingStatus.test.ts to cover the new permission-based skip logic
  • Updated useSettingsNavigationItems.test.tsx to verify Accounts visibility based on permissions

Testing

  1. Create a role with CONNECTED_ACCOUNTS permission disabled
  2. Create a new user with that role
  3. Verify onboarding skips the SYNC_EMAIL step
  4. Verify Settings > Accounts is hidden

…CTED_ACCOUNTS permission is disabled

Fixes twentyhq#17411

When CONNECTED_ACCOUNTS permission is disabled for a role:
- Hide the Accounts section in Settings navigation
- Skip the SYNC_EMAIL onboarding step and go directly to INVITE_TEAM

This prevents users without email/calendar sync permissions from seeing confusing UI prompts for features they cannot use.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

Welcome!

Hello there, congrats on your first PR! We're excited to have you contributing to this project.
By submitting your Pull Request, you acknowledge that you agree with the terms of our Contributor License Agreement.

Generated by 🚫 dangerJS against fb38f81

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 1, 2026

Greptile Overview

Greptile Summary

This PR fixes issue #17411 by hiding the Accounts settings section and skipping the SYNC_EMAIL onboarding step when the CONNECTED_ACCOUNTS permission is disabled.

Key Changes

  • Onboarding Flow: Modified useSetNextOnboardingStatus.ts to check CONNECTED_ACCOUNTS permission before transitioning to the SYNC_EMAIL onboarding step. Users without this permission now skip directly from PROFILE_CREATION to INVITE_TEAM.

  • Settings Navigation: Updated useSettingsNavigationItems.tsx to conditionally hide the Accounts navigation item (including its Emails and Calendars sub-items) based on the CONNECTED_ACCOUNTS permission flag.

  • Test Coverage: Both test files were updated to cover the new permission-based logic with comprehensive test cases.

Implementation Details

The implementation leverages the existing usePermissionFlagMap hook which reads from currentUserWorkspaceState to determine user permissions. The permission check is performed at render time for settings navigation and during onboarding status transitions.

The changes are minimal, focused, and follow existing patterns in the codebase for permission-based UI visibility.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-isolated, follow existing permission patterns, have comprehensive test coverage, and address a clear UX issue without introducing breaking changes
  • No files require special attention

Important Files Changed

Filename Overview
packages/twenty-front/src/modules/onboarding/hooks/useSetNextOnboardingStatus.ts Added permission check to skip SYNC_EMAIL onboarding step when CONNECTED_ACCOUNTS permission is disabled
packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx Added isHidden flag to Accounts navigation item based on CONNECTED_ACCOUNTS permission

Sequence Diagram

sequenceDiagram
    participant User
    participant OnboardingFlow
    participant PermissionCheck
    participant SettingsNav
    
    Note over User,SettingsNav: User with CONNECTED_ACCOUNTS disabled
    
    User->>OnboardingFlow: Start onboarding (PROFILE_CREATION)
    OnboardingFlow->>PermissionCheck: Check CONNECTED_ACCOUNTS permission
    PermissionCheck-->>OnboardingFlow: Permission = false
    OnboardingFlow->>OnboardingFlow: Skip SYNC_EMAIL step
    OnboardingFlow-->>User: Navigate to INVITE_TEAM
    
    User->>SettingsNav: Access Settings
    SettingsNav->>PermissionCheck: Check CONNECTED_ACCOUNTS permission
    PermissionCheck-->>SettingsNav: Permission = false
    SettingsNav->>SettingsNav: Set Accounts item as hidden
    SettingsNav-->>User: Accounts section not visible
    
    Note over User,SettingsNav: User with CONNECTED_ACCOUNTS enabled
    
    User->>OnboardingFlow: Start onboarding (PROFILE_CREATION)
    OnboardingFlow->>PermissionCheck: Check CONNECTED_ACCOUNTS permission
    PermissionCheck-->>OnboardingFlow: Permission = true
    OnboardingFlow-->>User: Navigate to SYNC_EMAIL
    
    User->>SettingsNav: Access Settings
    SettingsNav->>PermissionCheck: Check CONNECTED_ACCOUNTS permission
    PermissionCheck-->>SettingsNav: Permission = true
    SettingsNav-->>User: Accounts section visible
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:37642

This environment will automatically shut down when the PR is closed or after 5 hours.

@martmull
Copy link
Contributor

martmull commented Feb 4, 2026

waiting duplicated Pr #17598 to be merged before review or closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: CONNECTED_ACCOUNTS permission should control email/calendar sync onboarding step visibility

2 participants