Skip to content

fix(onboarding): trigger /welcome for email + OAuth signups - #11

Merged
hades217 merged 1 commit into
mainfrom
fix/onboarding-trigger
May 17, 2026
Merged

fix(onboarding): trigger /welcome for email + OAuth signups#11
hades217 merged 1 commit into
mainfrom
fix/onboarding-trigger

Conversation

@hades217

Copy link
Copy Markdown

Summary

Onboarding redirect to /welcome was broken on two paths — fixes both.

Bug 1 — Email Register never compiled

controller/user.go:238 assigned &settingStr (a *string) to User.Setting (declared as string at model/user.go:50). That's a Go type mismatch — the backend couldn't rebuild, so new email signups never got persona="unset" stamped into their setting JSON, so PersonaPickerHost never saw the sentinel, so /welcome never opened.

Fix: assign the marshaled JSON string directly.

Bug 2 — OAuth signups had no persona seed

User.Insert() initializes an empty dto.UserSetting{} when Setting == "" — this fires for every OAuth-created account (github / wechat / oidc / discord / linuxdo / telegram / generic oauth) because none of them pre-populate Setting before calling Insert. Without persona="unset", those users skipped the wizard entirely.

Fix: seed dto.UserSetting{Persona: "unset"} in the empty-Setting branch. Single change covers all OAuth handlers automatically.

Supporting frontend changes (already on this branch from prior work)

  • PersonaPickerHost rewritten as a /welcome redirect (not a blocking modal). One funnel for email + OAuth + legacy users.
  • Welcome wizard no longer auto-redirects when the sessionStorage handoff is missing — it still renders for any authenticated unset user.

Test plan

  • bun run typecheck — already green
  • Register a new email account → land on /welcome with 3-step wizard
  • Sign in via GitHub/WeChat/OIDC for a new account → land on /welcome
  • Sign in for an existing account (persona already set) → no redirect
  • Refresh on /welcome → no redirect loop
  • go build ./... once Go is available on the merge machine

🤖 Generated with Claude Code

The persona-based onboarding redirect was broken on two paths:

1. Email Register (controller/user.go:238) assigned `&settingStr` to
   `User.Setting` which is `string`, not `*string` — a Go compile error
   that prevented the backend from rebuilding, so new accounts never
   got persona="unset" stamped into their setting JSON.

2. OAuth signups (github/wechat/oidc/discord/linuxdo/telegram/oauth)
   created users with an empty Setting field, so PersonaPickerHost
   never saw the "unset" sentinel and never redirected them.

Fixes:
- controller/user.go: assign the marshaled JSON string directly.
- model/user.go Insert(): when Setting is empty, seed persona="unset"
  so every OAuth path inherits the redirect for free.
- PersonaPickerHost: was already converted from a blocking modal to a
  /welcome redirect (with loop guard for /welcome itself).
- Welcome wizard: tolerate missing sessionStorage handoff — still
  render the 3-step picker if the user lands without the auto-login
  payload (e.g. OAuth, refresh after dismiss).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@hades217
hades217 merged commit daac3cf into main May 17, 2026
2 checks passed
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