flagopinion

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 17 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

Index

Constants

View Source
const (
	MinAssessment = 1
	MaxAssessment = 10
)

Variables

View Source
var ErrUnavailable = errors.New("flag opinion unavailable")

Functions

func AdFactLines

func AdFactLines(a ad.Ad, tz *time.Location) []string

AdFactLines returns description history lines for UI display.

func ContainsPII

func ContainsPII(s string) bool

ContainsPII reports whether s still has likely PII patterns.

func Invalidate

func Invalidate(conversationID int) error

Invalidate removes the cached opinion for one conversation.

func InvalidateForAd

func InvalidateForAd(adID int) error

InvalidateForAd removes cached opinions for all conversations on an ad.

func RedactNames

func RedactNames(s string, names ...string) string

RedactNames replaces known participant names in text.

func RedactText

func RedactText(s string) string

RedactText replaces likely PII with a placeholder.

func SanitizeOpinionFields

func SanitizeOpinionFields(fields ...string) bool

SanitizeOpinionFields returns false if any field still contains PII.

func SetImageStore

func SetImageStore(store imagestore.Store)

SetImageStore sets the store used to attach ad images to opinions.

Types

type Opinion

type Opinion struct {
	ConversationID   int       `db:"conversation_id"`
	GeneratedAt      time.Time `db:"generated_at"`
	Summary          string    `db:"summary"`
	Assessment       int       `db:"assessment"`
	AssessmentDetail string    `db:"assessment_detail"`
	Resolution       string    `db:"resolution"`
	Reasoning        string    `db:"reasoning"`
}

Opinion is a cached or freshly generated dispute assessment.

func GetOrGenerate

func GetOrGenerate(conv message.Conversation,
	tz *time.Location) (Opinion, error)

GetOrGenerate returns a cached opinion or generates and stores one.

func Preview

func Preview(conv message.Conversation, throwerID int, reason string,
	tz *time.Location) (Opinion, error)

Preview generates an ephemeral opinion without storing or requiring a flag.

Jump to

Keyboard shortcuts

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