mentionhttp

package
v1.117.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package mentionhttp serves the people surfaces of the portal API: the known-users directory behind the share picker (#614), the audience-scoped candidate list behind the @-mention picker, and the caller's mentions inbox (#627).

It lives beside pkg/portal rather than inside it, like the prompt version REST surface, so the portal package stays within its size budget (#594). The composition root mounts these routes on the top-level mux wrapped in the portal's own authentication middleware and injects the identity accessor, so this package never imports pkg/portal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudienceReader

type AudienceReader interface {
	List(ctx context.Context, t mention.Target, opts mention.ListOptions) ([]mention.Person, error)
	Eligible(ctx context.Context, t mention.Target, emails []string) ([]string, error)
}

AudienceReader answers who may be mentioned on a thread target: the page the picker shows, and whether one person belongs to it. pkg/portal/mention.Audience implements it.

type Deps

type Deps struct {
	// Directory is the known-users store behind the share picker.
	Directory DirectoryReader
	// Audience answers who may be mentioned on a thread target.
	Audience AudienceReader
	// Threads reads the caller's mentions inbox.
	Threads threads.ThreadStore
	// Caller resolves the authenticated portal user, returning nil when the
	// request carries none.
	Caller func(*http.Request) *Identity
}

Deps carries the collaborators the handlers need. Each is optional: a deployment without a database leaves them nil and the routes they back are not registered.

type DirectoryReader

type DirectoryReader interface {
	List(ctx context.Context, filter userdir.Filter) ([]userdir.User, int, error)
}

DirectoryReader lists the known-users directory. The picker only reads it, so this is the whole surface it takes; pkg/user.Store implements it.

type Handler

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

Handler serves the people and mention routes.

func New

func New(deps Deps) *Handler

New builds the handler.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux, wrap func(http.Handler) http.Handler)

Register mounts the routes each wired dependency supports, wrapping every one in the portal's authentication middleware. Routes whose dependency is missing are left unregistered rather than serving an error, matching how the portal itself registers optional surfaces.

type Identity

type Identity struct {
	UserID  string
	Email   string
	IsAdmin bool
}

Identity is the authenticated portal caller resolved by the injected accessor.

Jump to

Keyboard shortcuts

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