From e549b9decf4b633efeb10edd999a085f19e31997 Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Thu, 21 Jul 2022 12:26:44 -0500 Subject: [PATCH] Set opened_by_id on the open ticket event as well as the ticket itself --- core/hooks/insert_tickets.go | 2 +- core/models/tickets.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/hooks/insert_tickets.go b/core/hooks/insert_tickets.go index ee93baf5e..51eafc937 100644 --- a/core/hooks/insert_tickets.go +++ b/core/hooks/insert_tickets.go @@ -36,7 +36,7 @@ func (h *insertTicketsHook) Apply(ctx context.Context, rt *runtime.Runtime, tx * openEvents := make([]*models.TicketEvent, len(tickets)) eventsByTicket := make(map[*models.Ticket]*models.TicketEvent, len(tickets)) for i, ticket := range tickets { - evt := models.NewTicketOpenedEvent(ticket, models.NilUserID, ticket.AssigneeID()) + evt := models.NewTicketOpenedEvent(ticket, ticket.OpenedByID(), ticket.AssigneeID()) openEvents[i] = evt eventsByTicket[ticket] = evt } diff --git a/core/models/tickets.go b/core/models/tickets.go index 1f23262d9..4ad0ed342 100644 --- a/core/models/tickets.go +++ b/core/models/tickets.go @@ -133,6 +133,7 @@ func (t *Ticket) LastActivityOn() time.Time { return t.t.LastActivityOn } func (t *Ticket) Config(key string) string { return t.t.Config.GetString(key, "") } +func (t *Ticket) OpenedByID() UserID { return t.t.OpenedByID } func (t *Ticket) FlowTicket(oa *OrgAssets) (*flows.Ticket, error) { modelTicketer := oa.TicketerByID(t.TicketerID())