profile

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package profile holds the Githome web front's profile handlers: the user and organization overview at /{owner} and its repositories tab. The catch-all sits at the root, after every owned top-level name and every /{owner}/{repo} surface is registered, so a reserved name (login, settings, search, an asset) is never read as a login. Each handler resolves the account through the domain user service, its repositories through the same domain search the search page uses (scoped to the owner), and its activity through the domain event service, maps the result into a fe/view model with every URL precomputed through fe/route, and renders through fe/render. An account that does not exist renders the same 404 as any other missing page. See implementation/12 sections 5, 6, and 7.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeedItems added in v0.1.3

func FeedItems(events []domain.Event) []view.FeedItemVM

FeedItems maps a page of events into timeline lines, skipping any event the catalog cannot place (one missing its actor or repository, which the feed never produces but the mapper guards against rather than panicking). It is exported because the dashboard's recent-activity feed reads the same stored events, and one catalog keeps the two timelines telling the same story for the same event.

Types

type Deps

type Deps struct {
	Users  *domain.UserService
	Events *domain.EventService
	Search *domain.SearchService
	Social *domain.SocialService
	URLs   *presenter.URLBuilder
	Render *render.Set
	View   *view.Builder
	Logger *slog.Logger
}

Deps are the profile handlers' dependencies: the user service for the identity lookup, the event service for the activity feed, the search service for the owner's repositories (the same service the search page reads, scoped to the owner with a user:/org: qualifier), the presenter for the avatar URL, the render set, the view builder for the shell chrome, the shared markup renderer for the profile bio, and a logger. The handler package maps domain data into fe/view models itself, so the view builder is needed only for Chrome. The bio is a single line shown as escaped plain text, so the profile needs no markup renderer.

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

Handlers is the profile handler set. One is built at boot and shared; it holds no per-request state.

func New

func New(d Deps) *Handlers

New wires the handler set from its dependencies.

func (*Handlers) Resolve

func (h *Handlers) Resolve(next mizu.Handler) mizu.Handler

Resolve loads the account named by the {owner} path parameter and stores it on the context for the handler. A reserved top-level name is never a login, so it renders the same 404 as a missing account rather than resolving; this is the one place the catch-all double-checks the reserved set, in case a future route is added under a reserved name without its own handler. An account that does not exist renders the generic 404 (the profile is a public surface, so there is no private-versus-missing split to hide here, unlike a repository). An infrastructure error is returned so the recover layer renders a 500.

func (*Handlers) Show

func (h *Handlers) Show(c *mizu.Ctx) error

Show renders a user or organization profile. The ?tab= facet selects the body: the overview (the default) pairs a short grid of the owner's recently updated repositories with their recent activity, and the repositories tab lists every visible repository with the same sort and pager the search page uses. The account was resolved by the Resolve middleware, so the handler only maps it and its backed data into the page model. A data error from the search or the feed is returned so the recover layer renders a 500; an empty result is a blankslate, not an error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL