notifywire

package
v1.132.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package notifywire assembles the notification substrate for the HTTP composition root: the delivery handle, the branded templates, the review and connection alerts, and the portal's notifier and self-scoped preference routes.

It was extracted from internal/httpserver (#1759) when that package reached its size budget. The seam is a real one: everything here takes a *platform.Platform and returns an assembled subsystem handle, and nothing in it touches a mux, a route or a middleware, which is what the composition root itself is about.

Index

Constants

View Source
const PortalToolkitKind = "portal"

PortalToolkitKind is the registry kind of the asset-portal toolkit.

Variables

This section is empty.

Functions

func BuildNotifications

func BuildNotifications(p *platform.Platform, brand Brand) *notifydelivery.Handle

BuildNotifications assembles the email-notification substrate from the platform's database, encryptor, and the brand supplied. Returns nil when the feature is unavailable (no platform, no database) or disabled by config; every consumer of the handle is nil-safe.

func BuildReviewAlert

func BuildReviewAlert(p *platform.Platform, notify *notifydelivery.Handle) *reviewalert.Checker

BuildReviewAlert assembles the scheduled knowledge review-queue staleness check. Returns nil (a no-op checker) when anything it needs is absent: no database, notifications off, no knowledge insight store -- an alert with nowhere to send is not an alert.

func ConnAlertSettings

func ConnAlertSettings(p *platform.Platform) connalert.SettingsStore

ConnAlertSettings narrows the store to the half the admin settings surface needs, or nil when the alert cannot exist here. A nil result unmounts the admin routes: an operator must not be able to name recipients for an alert nothing will ever send. The explicit nil check keeps a typed nil out of the interface.

func ConnAlertStore

func ConnAlertStore(p *platform.Platform) *connalert.PostgresStore

ConnAlertStore builds the connection-revocation alert's persistence (#1694), or nil when the alert cannot exist in this deployment: no database, or notifications turned off in YAML. Like the review alert's store it is stateless over the pool, so the admin API and the sweep each build one rather than sharing a handle whose lifecycle it does not have.

func ReviewAlertSettings

func ReviewAlertSettings(p *platform.Platform, target reviewalert.Target) reviewalert.SettingsStore

ReviewAlertSettings narrows one queue's store to the half the admin settings surface needs, or nil when the alert cannot exist here. A nil result unmounts the admin routes, matching what the SMTP section already does in the same states: an operator must not be able to configure an alert nothing will ever send. The explicit nil check keeps a typed nil out of the interface.

func WireConnRevocationAlert

func WireConnRevocationAlert(p *platform.Platform, notify *notifydelivery.Handle) *connalert.Escalator

WireConnRevocationAlert tells the auth-event writer where to announce a discarded credential (#1694), and returns the sweep that escalates one nobody has acted on. Both are nil when the alert cannot exist here.

The writer is built with the token store, long before the notification substrate exists, so the sink is attached here rather than at construction. It is the one dependency every connoauth.Source already carries, which is why the announcement rides it instead of being threaded a second time through every toolkit that wires OAuth.

func WirePortalNotifications

func WirePortalNotifications(deps *portal.Deps, p *platform.Platform, notify *notifydelivery.Handle, audience *mention.Audience)

WirePortalNotifications attaches the notification substrate to the portal dependency set: the share/thread trigger bridge and the self-scoped preference routes. A nil handle leaves both unset (feature unavailable).

The mention audience is supplied rather than built here: the composition root builds one and hands the same one to every surface that resolves a mention.

Types

type Brand

type Brand struct {
	// Name is the deployment's brand name, already resolved through its
	// fallbacks.
	Name string
	// UnsubscribeURL builds the no-login opt-out link for an address, or nil
	// when the endpoint cannot be served.
	UnsubscribeURL func(email string) string
}

Brand is what an email says it is from and where its footer links go. The composition root resolves both -- the brand name has fallbacks that belong to the portal's config, and the unsubscribe link needs the browser-session signing key -- so they arrive here rather than being derived twice.

Jump to

Keyboard shortcuts

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