Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎟️ No more ticket subjects #498

Merged
merged 1 commit into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/goflow/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ type simulatorTicketService struct {
ticketer *flows.Ticketer
}

func (s *simulatorTicketService) Open(session flows.Session, topic *flows.Topic, subject, body string, assignee *flows.User, logHTTP flows.HTTPLogCallback) (*flows.Ticket, error) {
return flows.OpenTicket(s.ticketer, topic, subject, body, assignee), nil
func (s *simulatorTicketService) Open(session flows.Session, topic *flows.Topic, body string, assignee *flows.User, logHTTP flows.HTTPLogCallback) (*flows.Ticket, error) {
return flows.OpenTicket(s.ticketer, topic, body, assignee), nil
}

func simulatorAirtimeServiceFactory(session flows.Session) (flows.AirtimeService, error) {
Expand Down
6 changes: 4 additions & 2 deletions core/goflow/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ func TestSimulatorTicket(t *testing.T) {
svc, err := goflow.Simulator(rt.Config).Services().Ticket(nil, flows.NewTicketer(ticketer))
assert.NoError(t, err)

ticket, err := svc.Open(nil, nil, "New ticket", "Where are my cookies?", nil, nil)
oa, err := models.GetOrgAssets(ctx, db, testdata.Org1.ID)
require.NoError(t, err)

ticket, err := svc.Open(nil, oa.SessionAssets().Topics().FindByName("General"), "Where are my cookies?", nil, nil)
assert.NoError(t, err)
assert.Equal(t, testdata.Mailgun.UUID, ticket.Ticketer().UUID())
assert.Equal(t, "New ticket", ticket.Subject())
assert.Equal(t, "Where are my cookies?", ticket.Body())
}

Expand Down
1 change: 0 additions & 1 deletion core/handlers/ticket_opened.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func handleTicketOpened(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, oa *mo
ticketer.ID(),
event.Ticket.ExternalID,
topicID,
event.Ticket.Subject,
event.Ticket.Body,
assigneeID,
map[string]interface{}{
Expand Down
4 changes: 1 addition & 3 deletions core/handlers/ticket_opened_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestTicketOpened(t *testing.T) {
}))

// an existing ticket
cathyTicket := models.NewTicket(flows.TicketUUID(uuids.New()), testdata.Org1.ID, testdata.Cathy.ID, testdata.Mailgun.ID, "748363", testdata.DefaultTopic.ID, "Old Question", "Who?", models.NilUserID, nil)
cathyTicket := models.NewTicket(flows.TicketUUID(uuids.New()), testdata.Org1.ID, testdata.Cathy.ID, testdata.Mailgun.ID, "748363", testdata.DefaultTopic.ID, "Who?", models.NilUserID, nil)
err := models.InsertTickets(ctx, db, []*models.Ticket{cathyTicket})
require.NoError(t, err)

Expand All @@ -57,7 +57,6 @@ func TestTicketOpened(t *testing.T) {
handlers.NewActionUUID(),
assets.NewTicketerReference(testdata.Mailgun.UUID, "Mailgun (IT Support)"),
assets.NewTopicReference(testdata.SupportTopic.UUID, "Support"),
"",
"Where are my cookies?",
assets.NewUserReference(testdata.Admin.Email, "Admin"),
"Email Ticket",
Expand All @@ -68,7 +67,6 @@ func TestTicketOpened(t *testing.T) {
handlers.NewActionUUID(),
assets.NewTicketerReference(testdata.Zendesk.UUID, "Zendesk (Nyaruka)"),
nil,
"Interesting",
"I've found some cookies",
nil,
"Zen Ticket",
Expand Down
2 changes: 1 addition & 1 deletion core/models/contacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func LoadContacts(ctx context.Context, db Queryer, org *OrgAssets, ids []Contact
for _, t := range e.Tickets {
ticketer := org.TicketerByID(t.TicketerID)
if ticketer != nil {
tickets = append(tickets, NewTicket(t.UUID, org.OrgID(), contact.ID(), ticketer.ID(), t.ExternalID, t.TopicID, t.Subject, t.Body, t.AssigneeID, nil))
tickets = append(tickets, NewTicket(t.UUID, org.OrgID(), contact.ID(), ticketer.ID(), t.ExternalID, t.TopicID, t.Body, t.AssigneeID, nil))
}
}
contact.tickets = tickets
Expand Down
8 changes: 3 additions & 5 deletions core/models/contacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ func TestContacts(t *testing.T) {
defer testsuite.Reset()

testdata.InsertContactURN(db, testdata.Org1, testdata.Bob, "whatsapp:250788373373", 999)
testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.SupportTopic, "Problem!", "Where are my shoes?", "1234", testdata.Agent)
testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.SalesTopic, "Another Problem!", "Where are my pants?", "2345", nil)
testdata.InsertOpenTicket(db, testdata.Org1, testdata.Bob, testdata.Mailgun, testdata.DefaultTopic, "Urgent", "His name is Bob", "", testdata.Editor)
testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.SupportTopic, "Where are my shoes?", "1234", testdata.Agent)
testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.SalesTopic, "Where are my pants?", "2345", nil)
testdata.InsertOpenTicket(db, testdata.Org1, testdata.Bob, testdata.Mailgun, testdata.DefaultTopic, "His name is Bob", "", testdata.Editor)

// delete mailgun ticketer
db.MustExec(`UPDATE tickets_ticketer SET is_active = false WHERE id = $1`, testdata.Mailgun.ID)
Expand Down Expand Up @@ -63,10 +63,8 @@ func TestContacts(t *testing.T) {
assert.Equal(t, 2, cathy.Tickets().Count())

cathyTickets := cathy.Tickets().All()
assert.Equal(t, "Problem!", cathyTickets[0].Subject())
assert.Equal(t, "Support", cathyTickets[0].Topic().Name())
assert.Equal(t, "agent1@nyaruka.com", cathyTickets[0].Assignee().Email())
assert.Equal(t, "Another Problem!", cathyTickets[1].Subject())
assert.Equal(t, "Sales", cathyTickets[1].Topic().Name())
assert.Nil(t, cathyTickets[1].Assignee())

Expand Down
2 changes: 1 addition & 1 deletion core/models/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func TestNonPersistentBroadcasts(t *testing.T) {
db.MustExec(`DELETE FROM tickets_ticket`)
}()

ticket := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Bob, testdata.Mailgun, testdata.DefaultTopic, "Problem", "", "", nil)
ticket := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Bob, testdata.Mailgun, testdata.DefaultTopic, "", "", nil)
modelTicket := ticket.Load(db)

translations := map[envs.Language]*models.BroadcastTranslation{envs.Language("eng"): {Text: "Hi there"}}
Expand Down
2 changes: 1 addition & 1 deletion core/models/notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func assertNotifications(t *testing.T, ctx context.Context, db *sqlx.DB, after t
}

func openTicket(t *testing.T, ctx context.Context, db *sqlx.DB, openedBy *testdata.User, assignee *testdata.User) (*models.Ticket, *models.TicketEvent) {
ticket := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Internal, testdata.SupportTopic, "", "Where my pants", "", assignee)
ticket := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Internal, testdata.SupportTopic, "Where my pants", "", assignee)
modelTicket := ticket.Load(db)

openedEvent := models.NewTicketOpenedEvent(modelTicket, openedBy.SafeID(), assignee.SafeID())
Expand Down
2 changes: 1 addition & 1 deletion core/models/ticket_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestTicketEvents(t *testing.T) {
db.MustExec(`DELETE FROM tickets_ticket`)
}()

ticket := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Need help", "Have you seen my cookies?", "17", nil)
ticket := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Have you seen my cookies?", "17", nil)
modelTicket := ticket.Load(db)

e1 := models.NewTicketOpenedEvent(modelTicket, testdata.Admin.ID, testdata.Agent.ID)
Expand Down
14 changes: 3 additions & 11 deletions core/models/tickets.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ type Ticket struct {
ExternalID null.String `db:"external_id"`
Status TicketStatus `db:"status"`
TopicID TopicID `db:"topic_id"`
Subject string `db:"subject"`
Body string `db:"body"`
AssigneeID UserID `db:"assignee_id"`
Config null.Map `db:"config"`
Expand All @@ -88,7 +87,7 @@ type Ticket struct {
}

// NewTicket creates a new open ticket
func NewTicket(uuid flows.TicketUUID, orgID OrgID, contactID ContactID, ticketerID TicketerID, externalID string, topicID TopicID, subject, body string, assigneeID UserID, config map[string]interface{}) *Ticket {
func NewTicket(uuid flows.TicketUUID, orgID OrgID, contactID ContactID, ticketerID TicketerID, externalID string, topicID TopicID, body string, assigneeID UserID, config map[string]interface{}) *Ticket {
t := &Ticket{}
t.t.UUID = uuid
t.t.OrgID = orgID
Expand All @@ -97,7 +96,6 @@ func NewTicket(uuid flows.TicketUUID, orgID OrgID, contactID ContactID, ticketer
t.t.ExternalID = null.String(externalID)
t.t.Status = TicketStatusOpen
t.t.TopicID = topicID
t.t.Subject = subject
t.t.Body = body
t.t.AssigneeID = assigneeID
t.t.Config = null.NewMap(config)
Expand All @@ -112,7 +110,6 @@ func (t *Ticket) TicketerID() TicketerID { return t.t.TicketerID }
func (t *Ticket) ExternalID() null.String { return t.t.ExternalID }
func (t *Ticket) Status() TicketStatus { return t.t.Status }
func (t *Ticket) TopicID() TopicID { return t.t.TopicID }
func (t *Ticket) Subject() string { return t.t.Subject }
func (t *Ticket) Body() string { return t.t.Body }
func (t *Ticket) AssigneeID() UserID { return t.t.AssigneeID }
func (t *Ticket) LastActivityOn() time.Time { return t.t.LastActivityOn }
Expand Down Expand Up @@ -146,7 +143,6 @@ func (t *Ticket) FlowTicket(oa *OrgAssets) (*flows.Ticket, error) {
t.UUID(),
oa.SessionAssets().Ticketers().Get(modelTicketer.UUID()),
topic,
t.Subject(),
t.Body(),
string(t.ExternalID()),
assignee,
Expand Down Expand Up @@ -183,7 +179,6 @@ SELECT
t.external_id AS external_id,
t.status AS status,
t.topic_id AS topic_id,
t.subject AS subject,
t.body AS body,
t.assignee_id AS assignee_id,
t.config AS config,
Expand Down Expand Up @@ -213,7 +208,6 @@ SELECT
t.external_id AS external_id,
t.status AS status,
t.topic_id AS topic_id,
t.subject AS subject,
t.body AS body,
t.assignee_id AS assignee_id,
t.config AS config,
Expand Down Expand Up @@ -262,7 +256,6 @@ SELECT
t.external_id AS external_id,
t.status AS status,
t.topic_id AS topic_id,
t.subject AS subject,
t.body AS body,
t.assignee_id AS assignee_id,
t.config AS config,
Expand Down Expand Up @@ -291,7 +284,6 @@ SELECT
t.external_id AS external_id,
t.status AS status,
t.topic_id AS topic_id,
t.subject AS subject,
t.body AS body,
t.assignee_id AS assignee_id,
t.config AS config,
Expand Down Expand Up @@ -333,8 +325,8 @@ func lookupTicket(ctx context.Context, db Queryer, query string, params ...inter

const insertTicketSQL = `
INSERT INTO
tickets_ticket(uuid, org_id, contact_id, ticketer_id, external_id, status, topic_id, subject, body, assignee_id, config, opened_on, modified_on, last_activity_on)
VALUES( :uuid, :org_id, :contact_id, :ticketer_id, :external_id, :status, :topic_id, :subject, :body, :assignee_id, :config, NOW(), NOW() , NOW())
tickets_ticket(uuid, org_id, contact_id, ticketer_id, external_id, status, topic_id, body, assignee_id, config, opened_on, modified_on, last_activity_on)
VALUES( :uuid, :org_id, :contact_id, :ticketer_id, :external_id, :status, :topic_id, :body, :assignee_id, :config, NOW(), NOW() , NOW())
RETURNING
id
`
Expand Down
44 changes: 20 additions & 24 deletions core/models/tickets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func TestTickets(t *testing.T) {
testdata.Mailgun.ID,
"EX12345",
testdata.DefaultTopic.ID,
"New Ticket",
"Where are my cookies?",
testdata.Admin.ID,
map[string]interface{}{
Expand All @@ -83,7 +82,6 @@ func TestTickets(t *testing.T) {
testdata.Zendesk.ID,
"EX7869",
testdata.SalesTopic.ID,
"New Zen Ticket",
"Where are my trousers?",
models.NilUserID,
nil,
Expand All @@ -95,7 +93,6 @@ func TestTickets(t *testing.T) {
testdata.Zendesk.ID,
"EX6677",
models.NilTopicID,
"Other Org Ticket",
"Where are my pants?",
testdata.Org2Admin.ID,
nil,
Expand All @@ -107,7 +104,6 @@ func TestTickets(t *testing.T) {
assert.Equal(t, testdata.Mailgun.ID, ticket1.TicketerID())
assert.Equal(t, null.String("EX12345"), ticket1.ExternalID())
assert.Equal(t, testdata.DefaultTopic.ID, ticket1.TopicID())
assert.Equal(t, "New Ticket", ticket1.Subject())
assert.Equal(t, "Cathy", ticket1.Config("contact-display"))
assert.Equal(t, testdata.Admin.ID, ticket1.AssigneeID())
assert.Equal(t, "", ticket1.Config("xyz"))
Expand All @@ -121,12 +117,12 @@ func TestTickets(t *testing.T) {
// can lookup a ticket by UUID
tk1, err := models.LookupTicketByUUID(ctx, db, "2ef57efc-d85f-4291-b330-e4afe68af5fe")
assert.NoError(t, err)
assert.Equal(t, "New Ticket", tk1.Subject())
assert.Equal(t, "Where are my cookies?", tk1.Body())

// can lookup a ticket by external ID and ticketer
tk2, err := models.LookupTicketByExternalID(ctx, db, testdata.Zendesk.ID, "EX7869")
assert.NoError(t, err)
assert.Equal(t, "New Zen Ticket", tk2.Subject())
assert.Equal(t, "Where are my trousers?", tk2.Body())

// can lookup open tickets by contact
org1, _ := models.GetOrgAssets(ctx, db, testdata.Org1.ID)
Expand All @@ -136,15 +132,15 @@ func TestTickets(t *testing.T) {
tks, err := models.LoadOpenTicketsForContact(ctx, db, cathy)
assert.NoError(t, err)
assert.Equal(t, 1, len(tks))
assert.Equal(t, "New Ticket", tks[0].Subject())
assert.Equal(t, "Where are my cookies?", tks[0].Body())
}

func TestUpdateTicketConfig(t *testing.T) {
ctx, _, db, _ := testsuite.Get()

defer deleteTickets(db)

ticket := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Problem", "Where my shoes", "123", nil)
ticket := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Where my shoes", "123", nil)
modelTicket := ticket.Load(db)

// empty configs are null
Expand All @@ -170,7 +166,7 @@ func TestUpdateTicketLastActivity(t *testing.T) {
defer dates.SetNowSource(dates.DefaultNowSource)
dates.SetNowSource(dates.NewFixedNowSource(now))

ticket := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Problem", "Where my shoes", "123", nil)
ticket := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Where my shoes", "123", nil)
modelTicket := ticket.Load(db)

models.UpdateTicketLastActivity(ctx, db, []*models.Ticket{modelTicket})
Expand All @@ -189,13 +185,13 @@ func TestTicketsAssign(t *testing.T) {
oa, err := models.GetOrgAssetsWithRefresh(ctx, db, testdata.Org1.ID, models.RefreshTicketers)
require.NoError(t, err)

ticket1 := testdata.InsertClosedTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Problem", "Where my shoes", "123", nil)
ticket1 := testdata.InsertClosedTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Where my shoes", "123", nil)
modelTicket1 := ticket1.Load(db)

ticket2 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.DefaultTopic, "Old Problem", "Where my pants", "234", nil)
ticket2 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.DefaultTopic, "Where my pants", "234", nil)
modelTicket2 := ticket2.Load(db)

testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Ignore", "", "", nil)
testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "", "", nil)

evts, err := models.TicketsAssign(ctx, db, oa, testdata.Admin.ID, []*models.Ticket{modelTicket1, modelTicket2}, testdata.Agent.ID, "please handle these")
require.NoError(t, err)
Expand All @@ -221,13 +217,13 @@ func TestTicketsAddNote(t *testing.T) {
oa, err := models.GetOrgAssetsWithRefresh(ctx, db, testdata.Org1.ID, models.RefreshTicketers)
require.NoError(t, err)

ticket1 := testdata.InsertClosedTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Problem", "Where my shoes", "123", nil)
ticket1 := testdata.InsertClosedTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Where my shoes", "123", nil)
modelTicket1 := ticket1.Load(db)

ticket2 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.DefaultTopic, "Old Problem", "Where my pants", "234", testdata.Agent)
ticket2 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.DefaultTopic, "Where my pants", "234", testdata.Agent)
modelTicket2 := ticket2.Load(db)

testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Ignore", "", "", nil)
testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "", "", nil)

evts, err := models.TicketsAddNote(ctx, db, oa, testdata.Admin.ID, []*models.Ticket{modelTicket1, modelTicket2}, "spam")
require.NoError(t, err)
Expand All @@ -249,16 +245,16 @@ func TestTicketsChangeTopic(t *testing.T) {
oa, err := models.GetOrgAssetsWithRefresh(ctx, db, testdata.Org1.ID, models.RefreshTicketers)
require.NoError(t, err)

ticket1 := testdata.InsertClosedTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.SalesTopic, "Problem", "Where my shoes", "123", nil)
ticket1 := testdata.InsertClosedTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.SalesTopic, "Where my shoes", "123", nil)
modelTicket1 := ticket1.Load(db)

ticket2 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.SupportTopic, "Old Problem", "Where my pants", "234", nil)
ticket2 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.SupportTopic, "Where my pants", "234", nil)
modelTicket2 := ticket2.Load(db)

ticket3 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.DefaultTopic, "", "Where my pants", "345", nil)
ticket3 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.DefaultTopic, "Where my pants", "345", nil)
modelTicket3 := ticket3.Load(db)

testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Ignore", "", "", nil)
testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "", "", nil)

evts, err := models.TicketsChangeTopic(ctx, db, oa, testdata.Admin.ID, []*models.Ticket{modelTicket1, modelTicket2, modelTicket3}, testdata.SupportTopic.ID)
require.NoError(t, err)
Expand Down Expand Up @@ -289,10 +285,10 @@ func TestCloseTickets(t *testing.T) {
oa, err := models.GetOrgAssetsWithRefresh(ctx, db, testdata.Org1.ID, models.RefreshTicketers)
require.NoError(t, err)

ticket1 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Problem", "Where my shoes", "123", nil)
ticket1 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Where my shoes", "123", nil)
modelTicket1 := ticket1.Load(db)

ticket2 := testdata.InsertClosedTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.DefaultTopic, "Old Problem", "Where my pants", "234", nil)
ticket2 := testdata.InsertClosedTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.DefaultTopic, "Where my pants", "234", nil)
modelTicket2 := ticket2.Load(db)

logger := &models.HTTPLogger{}
Expand All @@ -317,7 +313,7 @@ func TestCloseTickets(t *testing.T) {
testsuite.AssertQuery(t, db, `SELECT count(*) FROM tickets_ticketevent WHERE ticket_id = $1 AND event_type = 'C'`, ticket2.ID).Returns(0)

// can close tickets without a user
ticket3 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Problem", "Where my shoes", "123", nil)
ticket3 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Where my shoes", "123", nil)
modelTicket3 := ticket3.Load(db)

evts, err = models.CloseTickets(ctx, db, oa, models.NilUserID, []*models.Ticket{modelTicket3}, false, false, logger)
Expand Down Expand Up @@ -346,10 +342,10 @@ func TestReopenTickets(t *testing.T) {
oa, err := models.GetOrgAssetsWithRefresh(ctx, db, testdata.Org1.ID, models.RefreshTicketers)
require.NoError(t, err)

ticket1 := testdata.InsertClosedTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Problem", "Where my shoes", "123", nil)
ticket1 := testdata.InsertClosedTicket(db, testdata.Org1, testdata.Cathy, testdata.Mailgun, testdata.DefaultTopic, "Where my shoes", "123", nil)
modelTicket1 := ticket1.Load(db)

ticket2 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.DefaultTopic, "Old Problem", "Where my pants", "234", nil)
ticket2 := testdata.InsertOpenTicket(db, testdata.Org1, testdata.Cathy, testdata.Zendesk, testdata.DefaultTopic, "Where my pants", "234", nil)
modelTicket2 := ticket2.Load(db)

logger := &models.HTTPLogger{}
Expand Down
Loading