···7575 // TODO: get this in the original query; requires COALESCE because nullable
7676 var sourceRepo *models.Repo
7777 if repo.Source != "" {
7878- sourceRepo, err = GetRepoByAtUri(e, repo.Source)
7878+ if strings.HasPrefix(repo.Source, "did:") {
7979+ sourceRepo, err = GetRepoByDid(e, repo.Source)
8080+ } else {
8181+ sourceRepo, err = GetRepoByAtUri(e, repo.Source)
8282+ }
7983 if err != nil {
8080- // the source repo was not found, skip this bit
8184 log.Println("profile", "err", err)
8285 }
8386 }
···449452 query = `select count(id) from repos where did = ?`
450453 args = append(args, did)
451454 case models.VanityStatStarCount:
452452- query = `select count(id) from stars where subject_at like 'at://' || ? || '%'`
455455+ query = `select count(s.id) from stars s join repos r on (s.subject_at = r.at_uri or (s.subject_did is not null and s.subject_did = r.repo_did)) where r.did = ?`
453456 args = append(args, did)
454457 case models.VanityStatNone:
455458 return 0, nil