Documentation
¶
Overview ¶
Package history provides ticket history formatting and display utilities.
Package history provides ticket history recording and formatting utilities.
Index ¶
Constants ¶
const ( TypeNewTicket = "NewTicket" TypeOwnerUpdate = "OwnerUpdate" TypeStateUpdate = "StateUpdate" TypeAddNote = "AddNote" TypePriorityUpdate = "PriorityUpdate" TypeQueueMove = "Move" TypeSetPendingTime = "SetPendingTime" TypeMerged = "Merged" TypeTimeAccounting = "TimeAccounting" )
HistoryType constants for common ticket history events.
Variables ¶
This section is empty.
Functions ¶
func ChangeMessage ¶
ChangeMessage generates a history message for a field change.
func Excerpt ¶
Excerpt returns a truncated version of the input string, suitable for history messages.
func NormalizeHistoryName ¶
func NormalizeHistoryName(entry models.TicketHistoryEntry) string
NormalizeHistoryName converts the raw ticket_history.name field into a human readable label. OTRS stores structured payloads using double-percent (%%) delimiters; when those appear we decode the payload based on the reported history type and fall back to a reasonable string otherwise. This allows imported tickets to render meaningful events.
Types ¶
type HistoryInserter ¶
type HistoryInserter interface {
AddTicketHistoryEntry(ctx context.Context, exec interface{}, entry models.TicketHistoryInsert) error
}
HistoryInserter is an interface for inserting ticket history entries.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder records ticket history entries.
func NewRecorder ¶
func NewRecorder(repo interface{}) *Recorder
NewRecorder creates a new history recorder with the given repository. The repository should implement AddTicketHistoryEntry method. Returns nil if repo is nil.
func (*Recorder) Record ¶
func (r *Recorder) Record(ctx context.Context, tx interface{}, ticket interface{}, articleID interface{}, historyType string, message string, userID int) error
Record records a history entry for a ticket. The tx parameter can be nil to use the default database connection. ticket can be either a *models.Ticket or an int (ticket ID). articleID is optional and can be nil (accepts *int or *uint).
func (*Recorder) RecordByTicketID ¶
func (r *Recorder) RecordByTicketID(ctx context.Context, tx interface{}, ticketID int, articleID interface{}, historyType string, message string, userID int) error
RecordByTicketID records a history entry using a ticket ID directly. This is a convenience method when you only have a ticket ID.