caelum0x bf62de7ba5 feat(rithub): one-screen "Bring your code" onboarding for 0-repo users
Real gap: both real external signups (harish via email, blenderwebservices
via Google OAuth) landed with 0 repos and no next step — the existing
oauth-auto-import cron only ever fired for fresh GitHub-OAuth signups.

- New shared templates/shared/bring_your_code.tmpl: one screen, three
  one-click paths — "Import from GitHub" (/user/oauth2/GitHub, which
  Gitea's own stock account-linking already handles correctly for an
  already-signed-in user regardless of their original login source),
  "Import by URL" (single visible field, posts straight to the stock
  /repo/migrate route with every other required field — service, uid,
  mirror, repo_name — sent hidden/JS-derived from the pasted URL), and
  "Start an empty repo" (stock /repo/create).
- dashboard.tmpl / profile.tmpl overrides: show this CTA instead of the
  blank dashboard / empty repo-list tab when SignedUser.NumRepos==0 (own
  profile only — strangers viewing someone else's empty profile are
  unaffected).
- oauth-auto-import-loop.sh + rithub-oauth-auto-import.service: replaces
  the old */5 cron tick with a ~20s poll loop so a GitHub sign-in/link
  produces a visible repo within roughly a minute, not up to 5.

Live-verified end to end on rithub.dev with a disposable QA account
(created+deleted): dashboard/profile render the CTA at 0 repos, "Import
by URL" against a real small GitHub repo creates it and the UI reverts
to normal at 1 repo, GitHub-link redirect confirmed correct while
logged in. QA account, repo and mail.tm inbox all deleted after.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-19 17:52:35 +03:00

55 lines
2.1 KiB
Cheetah

{{/*
Rithub override of Gitea's templates/user/profile.tmpl (upstream
v1.23.8, verified byte-identical before this edit). Only change: the
default "Repositories" tab (the final {{else}} branch below — upstream
has no separate "repositories" TabName, this is the catch-all) shows
the "Bring your code" CTA (templates/shared/bring_your_code.tmpl)
instead of the stock empty repo-list grid, but ONLY when the viewer
is signed in and looking at their OWN profile and it really has 0
repos. A stranger viewing someone else's empty profile still sees the
stock "no repos" message — the CTA is never shown to anyone but the
account owner.
plans/railyard.md, 2026-11-19 ("bring-your-code" onboarding task).
*/}}
{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content user profile">
<div class="ui container">
<div class="ui stackable grid">
<div class="ui four wide column">
{{template "shared/user/profile_big_avatar" .}}
</div>
<div class="ui twelve wide column tw-mb-4">
{{template "user/overview/header" .}}
{{if eq .TabName "activity"}}
{{if .ContextUser.KeepActivityPrivate}}
<div class="ui info message">
<p>{{ctx.Locale.Tr "user.disabled_public_activity"}}</p>
</div>
{{end}}
{{template "user/heatmap" .}}
{{template "user/dashboard/feeds" .}}
{{else if eq .TabName "stars"}}
<div class="stars">
{{template "shared/repo_search" .}}
{{template "explore/repo_list" .}}
{{template "base/paginate" .}}
</div>
{{else if eq .TabName "following"}}
{{template "repo/user_cards" .}}
{{else if eq .TabName "followers"}}
{{template "repo/user_cards" .}}
{{else if eq .TabName "overview"}}
<div id="readme_profile" class="markup">{{.ProfileReadme}}</div>
{{else if and .IsSigned .SignedUser (eq .SignedUser.ID .ContextUser.ID) (eq .ContextUser.NumRepos 0)}}
{{template "shared/bring_your_code" .}}
{{else}}
{{template "shared/repo_search" .}}
{{template "explore/repo_list" .}}
{{template "base/paginate" .}}
{{end}}
</div>
</div>
</div>
</div>
{{template "base/footer" .}}