Skip to content

Conversation

ameer2468
Copy link
Collaborator

@ameer2468 ameer2468 commented Oct 16, 2025

Set organization names based on onboarding progress:

  • Skip from welcome step: Sets org name to "Your Organization" (existing behavior)
  • Skip from later steps: Sets org name to "{firstName}'s organization" using the name entered in welcome step
  • Preserves custom names: If user completed org setup with a custom name, that name is retained and not overwritten.

Summary by CodeRabbit

  • New Features

    • Smarter onboarding skip: automatically fills in placeholder names for you and your organization when steps aren’t completed, enabling a smoother jump to the dashboard.
  • Bug Fixes

    • Prevents unintended renaming of an existing organization when skipping onboarding.
    • Improves consistency of onboarding progress and displayed profile/organization details after skipping.

Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Reworked skipToDashboard to use a read-then-transaction flow. It fetches the user, starts a transaction, updates user name and onboarding steps, reads the active organization, and conditionally updates the organization name based on onboarding completion or absence of an existing organization.

Changes

Cohort / File(s) Summary of changes
Users onboarding transaction refactor
packages/web-backend/src/Users/UsersOnboarding.ts
Replaced single update with transactional flow: read user, update user fields, read organization by activeOrganizationId, and conditionally update organization name. Added computed placeholders for user/organization names based on onboarding state.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant C as Caller
    participant U as UsersOnboarding.skipToDashboard
    participant DB as Database

    C->>U: skipToDashboard(userId)
    U->>DB: SELECT user by userId
    DB-->>U: user{ name, activeOrganizationId, onboardingSteps }

    rect rgba(200,220,255,0.25)
    note over U,DB: Transaction
    U->>DB: BEGIN
    U->>DB: UPDATE users SET name=?, onboardingSteps=?
    U->>DB: SELECT organization by activeOrganizationId
    alt org missing OR onboarding not complete
        U->>DB: UPDATE organizations SET name=?
    else org exists AND onboarding complete
        note over U,DB: Skip org update
    end
    U->>DB: COMMIT
    end

    U-->>C: Result/redirect to dashboard
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I hop through transactions, light on my feet,
Reading, then writing, a careful heartbeat.
Names set just so, orgs updated with care,
Placeholders vanish—real values appear.
Thump goes the commit, carrots well-earned—
To the dashboard we bound, flags neatly turned. 🥕

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch set-org-name-when-skipping

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c25541b and bd7b20d.

📒 Files selected for processing (1)
  • packages/web-backend/src/Users/UsersOnboarding.ts (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ameer2468 ameer2468 merged commit e1ca80a into main Oct 16, 2025
14 of 15 checks passed
@ameer2468 ameer2468 deleted the set-org-name-when-skipping branch October 16, 2025 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant