Phase 13, part 3: signing up, and several teams per person

On the multi-tenant edition anyone can set up a team: their account, the
company and its website, whose registered domain the team works on (the
profile keeps to it). A person can belong to several teams and switch
between them from the sidebar, or set up another. Inviting someone who has
an account adds them to the team.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 12:17:15 -07:00
co-authored by Claude Opus 5.5
parent 210b1e57fc
commit d5fb1898e8
16 changed files with 545 additions and 13 deletions
+16 -4
View File
@@ -251,6 +251,11 @@ func (s *Server) Handler() (http.Handler, error) {
// Signing in (the server edition).
mux.HandleFunc("GET /setup/{token}", (*Server).setupPage)
mux.HandleFunc("POST /setup/{token}", (*Server).setupSave)
mux.HandleFunc("GET /signup", (*Server).signupPage)
mux.HandleFunc("POST /signup", (*Server).signup)
mux.HandleFunc("POST /teams/switch", (*Server).teamSwitch)
mux.HandleFunc("GET /teams/new", (*Server).teamNewPage)
mux.HandleFunc("POST /teams/new", (*Server).teamNew)
mux.HandleFunc("GET /signin", (*Server).signinPage)
mux.HandleFunc("POST /signin", (*Server).signin)
mux.HandleFunc("POST /signin/code", (*Server).signinCode)
@@ -687,10 +692,13 @@ type page struct {
NewProspects int // companies and people waiting for review, shown in the menu
Drafts int // outreach drafts waiting, shown in the menu
Bare bool // no sidebar: pages before signing in
CSRF string // the form token, for htmx (app.js)
Approvals int // agents' requests waiting for this viewer
Viewer *viewer // who's looking
Bare bool // no sidebar: pages before signing in
CSRF string // the form token, for htmx (app.js)
Approvals int // agents' requests waiting for this viewer
Teams []users.TeamInfo // the viewer\'s teams (multi-tenant), for the switcher
TeamID int64 // the team they\'re working in
Multi bool // the multi-tenant edition
Viewer *viewer // who's looking
}
// Section is the top bar's first breadcrumb, from Nav.
@@ -768,7 +776,9 @@ func (s *Server) render(w http.ResponseWriter, r *http.Request, name string, p p
p.Viewer = viewerOf(r)
if !p.Bare {
p.Approvals = s.waitingFor(p.Viewer)
p.Teams, p.TeamID = s.teamsOf(p.Viewer), s.team()
}
p.Multi = s.multi()
out, err := withCSRF(r, func(b *bytes.Buffer) error { return t.ExecuteTemplate(b, "layout.html", p) })
if err != nil {
s.Log.Error("render", "page", name, "err", err)
@@ -823,6 +833,8 @@ var flashes = map[string]string{
"withdrawn-class": "Withdrawn: it asks again from now on.",
"agent-paused": "Paused: every call it makes is refused until you resume it.",
"agent-resumed": "Resumed.",
"team-created": "Your team is set up. Start with the company's profile.",
"added": "Added: they're told by email, and sign in as they do.",
"account-removed": "Signed out: posts scheduled to it are back in Posts.",
"own-account-connected": "Connected: you can post as it, and an admin can let others.",
"deleted": "Deleted.",