Monorepo for Tangled
0

Configure Feed

Select the types of activity you want to include in your feed.

appview/oauth: navigate first-time tangled users to welcome screen

Signed-off-by: oppiliappan <me@oppi.li>

oppiliappan (Jul 7, 2026, 3:55 PM +0100) 1450de7d 93d553bd

+67 -1
+44
appview/db/profile.go
··· 398 398 return syntax.DID(did), nil 399 399 } 400 400 401 + // whether a DID has authored any Tangled record, counts some common records towards this 402 + func IsTangledUser(e Execer, did string) (bool, error) { 403 + profile, err := GetProfile(e, did) 404 + if err != nil { 405 + return false, err 406 + } 407 + if profile != nil { 408 + return true, nil 409 + } 410 + 411 + keys, err := GetPublicKeysForDid(e, did) 412 + if err != nil { 413 + return false, err 414 + } 415 + if len(keys) > 0 { 416 + return true, nil 417 + } 418 + 419 + counts := []func() (int64, error){ 420 + func() (int64, error) { return CountRepos(e, orm.FilterEq("did", did)) }, 421 + func() (int64, error) { return CountStrings(e, orm.FilterEq("did", did)) }, 422 + func() (int64, error) { return CountStars(e, orm.FilterEq("did", did)) }, 423 + } 424 + for _, count := range counts { 425 + n, err := count() 426 + if err != nil { 427 + return false, err 428 + } 429 + if n > 0 { 430 + return true, nil 431 + } 432 + } 433 + 434 + stats, err := GetFollowerFollowingCount(e, did) 435 + if err != nil { 436 + return false, err 437 + } 438 + if stats.Following > 0 { 439 + return true, nil 440 + } 441 + 442 + return false, nil 443 + } 444 + 401 445 func GetProfile(e Execer, did string) (*models.Profile, error) { 402 446 var profile models.Profile 403 447 var pronouns sql.Null[string]
+17 -1
appview/oauth/handler.go
··· 95 95 96 96 o.Logger.Debug("session saved successfully") 97 97 98 + did := sessData.AccountDID.String() 99 + isTangledUser, _ := db.IsTangledUser(o.Db, did) 100 + isNewUser := !isTangledUser 101 + if isNewUser { 102 + if ob, _ := db.GetOnboarding(o.Db, did); ob == nil { 103 + if err := db.UpsertOnboarding(o.Db, &models.Onboarding{ 104 + Did: did, 105 + Step: models.OnboardingStepProfile, 106 + Status: models.OnboardingInProgress, 107 + }); err != nil { 108 + o.Logger.Error("failed to seed onboarding record", "did", did, "err", err) 109 + } 110 + } 111 + } 112 + 98 113 go o.addToDefaultKnot(sessData.AccountDID) 99 114 go o.addToDefaultSpindle(sessData.AccountDID.String()) 100 - go o.ensureTangledProfile(sessData) 101 115 go o.autoClaimTnglShDomain(sessData.AccountDID.String()) 102 116 103 117 if !o.Config.Core.Dev { ··· 116 130 117 131 if o.isAccountDeactivated(sessData) { 118 132 redirectURL = "/settings/profile" 133 + } else if isNewUser { 134 + redirectURL = "/welcome" 119 135 } 120 136 121 137 http.Redirect(w, r, redirectURL, http.StatusFound)
+6
appview/state/profile.go
··· 79 79 profile = &models.Profile{Did: did} 80 80 } 81 81 82 + isTangledUser, err := db.IsTangledUser(s.db, did) 83 + if err != nil { 84 + return nil, fmt.Errorf("failed to determine tangled user status: %w", err) 85 + } 86 + 82 87 repoCount, err := db.CountRepos(s.db, orm.FilterEq("did", did)) 83 88 if err != nil { 84 89 return nil, fmt.Errorf("failed to get repo count: %w", err) ··· 130 135 return &pages.ProfileCard{ 131 136 UserDid: did, 132 137 HasProfile: hasProfile, 138 + IsTangledUser: isTangledUser, 133 139 Profile: profile, 134 140 FollowStatus: followStatus, 135 141 VouchRelationship: vouchRelationship,