notifypref

package
v0.193.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package notifypref stores each user's notification preferences (migration 0094, notify_preferences). Today there is one: TmuxAddress, "Show tmux session in notifications" (Account → Notifications), which internal/api's name rule reads when a notification names a mirrored session (names.go there, notifyName; docs/focus.md#a-sessions-name).

🔴 OFF UNLESS THE USER TURNED IT ON. No row, a row the user wrote off, and a read that fails are all off: off is exactly the text every user had before the preference existed.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotOwner = errors.New("notifypref: a preference is read only as its owner or as the system")

ErrNotOwner refuses a read whose ctx can see neither owner's row nor every row.

Functions

This section is empty.

Types

type PG

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

PG is Store on notify_preferences, under row-level security.

func NewPG

func NewPG(pool *pgxpool.Pool) *PG

NewPG is Store over pool.

func (*PG) SetTmuxAddress

func (p *PG) SetTmuxAddress(ctx context.Context, owner int64, on bool) error

SetTmuxAddress implements Store: the CALLER's row (row-level security refuses another owner's).

func (*PG) TmuxAddress

func (p *PG) TmuxAddress(ctx context.Context, owner int64) (bool, error)

TmuxAddress implements Store.

🔴 IT REFUSES A ctx THAT ROW-LEVEL SECURITY WOULD BLIND. A row of owner's is invisible to another user's principal and to a principal-less ctx, and would read as "no row" — off — for a user who turned it on: their notifications would silently lose the address on that path. So only owner's own principal or the system scope may read; anything else is an error (the caller reads it as off, and logs it, so the path is found).

type Store

type Store interface {
	// TmuxAddress reports whether owner turned on "Show tmux session in
	// notifications". No row is false.
	TmuxAddress(ctx context.Context, owner int64) (bool, error)
	// SetTmuxAddress records owner's choice.
	SetTmuxAddress(ctx context.Context, owner int64, on bool) error
}

Store is the per-user notification preferences.

Jump to

Keyboard shortcuts

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