Skip to content
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
2 changes: 0 additions & 2 deletions contract/battery.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ func Cases() []Case {
Notes: "All seeded tickets, last activity DESC; empty next_cursor, has_more false."},
{Name: "tickets/list_repeated_status_filter", Method: "GET", Path: "/api/v1/tickets?status_id=1&status_id=5", Auth: AuthReadTickets,
Notes: "Repeated query params build a repeated field: tickets 43 and 42 only."},
{Name: "tickets/list_state_filter", Method: "GET", Path: "/api/v1/tickets?ticket_state=resolved", Auth: AuthReadTickets,
Notes: "String filter: resolved only."},
{Name: "tickets/list_category_includes_subcategories", Method: "GET", Path: "/api/v1/tickets?category_id=1", Auth: AuthReadTickets,
Notes: "Category filter expands the subtree by default: parent 1 pulls in child category 5."},
{Name: "tickets/list_category_exclude_subcategories", Method: "GET", Path: "/api/v1/tickets?category_id=1&exclude_subcategories=true", Auth: AuthReadTickets,
Expand Down
15 changes: 0 additions & 15 deletions contract/fake_datastore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ func seedTickets() []*types.Ticket {
CategoryId: 5,
CategoryTitle: "S1 Personnel",
CategoryAncestorIds: []uint32{1},
TicketState: "open",
StatusId: 2,
StatusName: "In Progress",
PriorityId: 2,
Expand Down Expand Up @@ -439,7 +438,6 @@ func seedTickets() []*types.Ticket {
CategoryId: 7,
CategoryTitle: "S6 Technical Support",
CategoryAncestorIds: []uint32{},
TicketState: "resolved",
StatusId: 5,
StatusName: "Resolved",
PriorityId: 1,
Expand All @@ -465,7 +463,6 @@ func seedTickets() []*types.Ticket {
CategoryId: 1,
CategoryTitle: "Recruiting",
CategoryAncestorIds: []uint32{},
TicketState: "open",
StatusId: 1,
StatusName: "New",
PriorityId: 3,
Expand Down Expand Up @@ -632,9 +629,6 @@ func matchTicket(t *types.Ticket, f *datastores.ListTicketsFilter) bool {
return false
}
}
if len(f.TicketStates) > 0 && !containsStr(f.TicketStates, t.TicketState) {
return false
}
if len(f.StatusIDs) > 0 && !containsU32(f.StatusIDs, t.StatusId) {
return false
}
Expand Down Expand Up @@ -662,15 +656,6 @@ func containsU32(haystack []uint32, needle uint32) bool {
return false
}

func containsStr(haystack []string, needle string) bool {
for _, v := range haystack {
if v == needle {
return true
}
}
return false
}

func (recordingDatastore) GetTicket(_ context.Context, _ datastores.TicketReferenceCache, ticketID uint32, _ string) (*types.Ticket, error) {
for _, t := range seedTickets() {
if t.TicketId == ticketID {
Expand Down
1 change: 0 additions & 1 deletion contract/goldens/tickets/get_by_id_happy.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"ticketId": 42,
"ticketLocked": false,
"ticketRef": "MF1UI9HE",
"ticketState": "open",
"title": "Enlistment — John.Doe",
"totalMessageCount": 3
},
Expand Down
1 change: 0 additions & 1 deletion contract/goldens/tickets/get_by_ref_happy.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"ticketId": 42,
"ticketLocked": false,
"ticketRef": "MF1UI9HE",
"ticketState": "open",
"title": "Enlistment — John.Doe",
"totalMessageCount": 3
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"ticketId": 42,
"ticketLocked": false,
"ticketRef": "MF1UI9HE",
"ticketState": "open",
"title": "Enlistment — John.Doe",
"totalMessageCount": 3
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"ticketId": 44,
"ticketLocked": false,
"ticketRef": "ZZTOP44Q",
"ticketState": "open",
"title": "Transfer request: Bravo to Alpha",
"totalMessageCount": 2
},
Expand Down Expand Up @@ -83,7 +82,6 @@
"ticketId": 42,
"ticketLocked": false,
"ticketRef": "MF1UI9HE",
"ticketState": "open",
"title": "Enlistment — John.Doe",
"totalMessageCount": 3
}
Expand Down
3 changes: 0 additions & 3 deletions contract/goldens/tickets/list_default.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"ticketId": 44,
"ticketLocked": false,
"ticketRef": "ZZTOP44Q",
"ticketState": "open",
"title": "Transfer request: Bravo to Alpha",
"totalMessageCount": 2
},
Expand Down Expand Up @@ -76,7 +75,6 @@
"ticketId": 43,
"ticketLocked": false,
"ticketRef": "QQWW43RR",
"ticketState": "resolved",
"title": "TeamSpeak <connection> issues & errors",
"totalMessageCount": 1
},
Expand Down Expand Up @@ -114,7 +112,6 @@
"ticketId": 42,
"ticketLocked": false,
"ticketRef": "MF1UI9HE",
"ticketState": "open",
"title": "Enlistment — John.Doe",
"totalMessageCount": 3
}
Expand Down
1 change: 0 additions & 1 deletion contract/goldens/tickets/list_page_two.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"ticketId": 43,
"ticketLocked": false,
"ticketRef": "QQWW43RR",
"ticketState": "resolved",
"title": "TeamSpeak <connection> issues & errors",
"totalMessageCount": 1
}
Expand Down
1 change: 0 additions & 1 deletion contract/goldens/tickets/list_per_page_camel.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"ticketId": 44,
"ticketLocked": false,
"ticketRef": "ZZTOP44Q",
"ticketState": "open",
"title": "Transfer request: Bravo to Alpha",
"totalMessageCount": 2
}
Expand Down
1 change: 0 additions & 1 deletion contract/goldens/tickets/list_per_page_snake.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"ticketId": 44,
"ticketLocked": false,
"ticketRef": "ZZTOP44Q",
"ticketState": "open",
"title": "Transfer request: Bravo to Alpha",
"totalMessageCount": 2
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"ticketId": 43,
"ticketLocked": false,
"ticketRef": "QQWW43RR",
"ticketState": "resolved",
"title": "TeamSpeak <connection> issues & errors",
"totalMessageCount": 1
},
Expand Down Expand Up @@ -69,7 +68,6 @@
"ticketId": 42,
"ticketLocked": false,
"ticketRef": "MF1UI9HE",
"ticketState": "open",
"title": "Enlistment — John.Doe",
"totalMessageCount": 3
}
Expand Down
2 changes: 0 additions & 2 deletions contract/goldens/tickets/list_starter_filter.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"ticketId": 44,
"ticketLocked": false,
"ticketRef": "ZZTOP44Q",
"ticketState": "open",
"title": "Transfer request: Bravo to Alpha",
"totalMessageCount": 2
},
Expand Down Expand Up @@ -83,7 +82,6 @@
"ticketId": 42,
"ticketLocked": false,
"ticketRef": "MF1UI9HE",
"ticketState": "open",
"title": "Enlistment — John.Doe",
"totalMessageCount": 3
}
Expand Down
48 changes: 0 additions & 48 deletions contract/goldens/tickets/list_state_filter.golden.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"ticketId": 44,
"ticketLocked": false,
"ticketRef": "ZZTOP44Q",
"ticketState": "open",
"title": "Transfer request: Bravo to Alpha",
"totalMessageCount": 2
},
Expand Down Expand Up @@ -76,7 +75,6 @@
"ticketId": 43,
"ticketLocked": false,
"ticketRef": "QQWW43RR",
"ticketState": "resolved",
"title": "TeamSpeak <connection> issues & errors",
"totalMessageCount": 1
},
Expand Down Expand Up @@ -114,7 +112,6 @@
"ticketId": 42,
"ticketLocked": false,
"ticketRef": "MF1UI9HE",
"ticketState": "open",
"title": "Enlistment — John.Doe",
"totalMessageCount": 3
}
Expand Down
5 changes: 0 additions & 5 deletions datastores/tickets.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
type ListTicketsFilter struct {
CategoryIDs []uint32
ExcludeSubcategories bool
TicketStates []string
StatusIDs []uint32
PrefixIDs []uint32
AssignedUserIDs []uint32
Expand Down Expand Up @@ -154,9 +153,6 @@ func (ds *Mysql) ListTickets(ctx context.Context, rc TicketReferenceCache, f *Li
}
q = q.Where("ticket_category_id IN ?", ids)
}
if len(f.TicketStates) > 0 {
q = q.Where("ticket_state IN ?", f.TicketStates)
}
if len(f.StatusIDs) > 0 {
q = q.Where("status_id IN ?", f.StatusIDs)
}
Expand Down Expand Up @@ -276,7 +272,6 @@ func generateTicketProto(t *xenforo.Ticket, rc TicketReferenceCache, forumBase s
Title: t.Title,
CategoryId: t.TicketCategoryID,
CategoryAncestorIds: ancestors,
TicketState: t.TicketState,
StatusId: t.StatusID,
StatusName: rc.StatusName(t.StatusID),
PriorityId: t.Priority,
Expand Down
5 changes: 2 additions & 3 deletions datastores/tickets_harness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ func TestListTickets_HydratesTicketShape(t *testing.T) {
if len(got.CategoryAncestorIds) != 0 {
t.Errorf("root category has no ancestors, got %v", got.CategoryAncestorIds)
}
if got.TicketState != "open" || got.DiscussionState != "visible" || got.TicketLocked {
t.Errorf("state = %q/%q locked=%v", got.TicketState, got.DiscussionState, got.TicketLocked)
if got.DiscussionState != "visible" || got.TicketLocked {
t.Errorf("state = %q locked=%v", got.DiscussionState, got.TicketLocked)
}
if got.StarterUserId != 400 || got.StarterUsername != "TicketGuy.G" {
t.Errorf("starter = %d %q", got.StarterUserId, got.StarterUsername)
Expand Down Expand Up @@ -188,7 +188,6 @@ func TestListTickets_Filters(t *testing.T) {
}{
{"status ids", datastores.ListTicketsFilter{StatusIDs: []uint32{3}}, []uint32{4, 7}},
{"repeated status ids", datastores.ListTicketsFilter{StatusIDs: []uint32{2, 3}}, []uint32{2, 4, 7, 6}},
{"ticket states", datastores.ListTicketsFilter{TicketStates: []string{"resolved"}}, []uint32{4, 7}},
{"prefix ids", datastores.ListTicketsFilter{PrefixIDs: []uint32{1}}, []uint32{2, 7}},
{"assigned user", datastores.ListTicketsFilter{AssignedUserIDs: []uint32{401}}, []uint32{9, 1, 2, 4, 7, 6}},
{"starter user", datastores.ListTicketsFilter{StarterUserIDs: []uint32{400}}, []uint32{1}},
Expand Down
10 changes: 0 additions & 10 deletions openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -678,13 +678,6 @@ paths:
required: false
schema:
type: boolean
- name: ticketState
in: query
required: false
schema:
type: array
items:
type: string
- name: statusId
in: query
required: false
Expand Down Expand Up @@ -1721,8 +1714,6 @@ components:
items:
type: integer
minimum: 0
ticketState:
type: string
statusId:
type: integer
minimum: 0
Expand Down Expand Up @@ -1807,7 +1798,6 @@ components:
- categoryId
- categoryTitle
- categoryAncestorIds
- ticketState
- statusId
- statusName
- priorityId
Expand Down
15 changes: 0 additions & 15 deletions rest/fake_tickets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func seedTickets() []*types.Ticket {
CategoryId: 5,
CategoryTitle: "S1 Personnel",
CategoryAncestorIds: []uint32{1},
TicketState: "open",
StatusId: 2,
StatusName: "In Progress",
PriorityId: 2,
Expand Down Expand Up @@ -67,7 +66,6 @@ func seedTickets() []*types.Ticket {
CategoryId: 7,
CategoryTitle: "S6 Technical Support",
CategoryAncestorIds: []uint32{},
TicketState: "resolved",
StatusId: 5,
StatusName: "Resolved",
PriorityId: 1,
Expand All @@ -93,7 +91,6 @@ func seedTickets() []*types.Ticket {
CategoryId: 1,
CategoryTitle: "Recruiting",
CategoryAncestorIds: []uint32{},
TicketState: "open",
StatusId: 1,
StatusName: "New",
PriorityId: 3,
Expand Down Expand Up @@ -264,9 +261,6 @@ func matchTicket(t *types.Ticket, f *datastores.ListTicketsFilter) bool {
return false
}
}
if len(f.TicketStates) > 0 && !containsStr(f.TicketStates, t.TicketState) {
return false
}
if len(f.StatusIDs) > 0 && !containsU32(f.StatusIDs, t.StatusId) {
return false
}
Expand Down Expand Up @@ -294,15 +288,6 @@ func containsU32(haystack []uint32, needle uint32) bool {
return false
}

func containsStr(haystack []string, needle string) bool {
for _, v := range haystack {
if v == needle {
return true
}
}
return false
}

func (f *fakeDatastore) GetTicket(_ context.Context, rc datastores.TicketReferenceCache, ticketID uint32, _ string) (*types.Ticket, error) {
f.lastRC = rc
if f.getTicket != nil {
Expand Down
7 changes: 1 addition & 6 deletions rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ func (b *queryBinder) bracketGroups(snake string) [][]string {
// the cross-group order here is the deterministic ruling. nil when absent.
// Always a fresh slice once anything joins the snake values: appending onto
// b.values[snake] directly would write into the url.Values backing array
// when it has spare capacity (and stringSliceField hands the result to
// callers).
// when it has spare capacity.
func (b *queryBinder) raw(snake string) []string {
vals := b.values[snake]
var camelVals []string
Expand Down Expand Up @@ -191,10 +190,6 @@ func (b *queryBinder) stringField(snake string) string {
return vals[len(vals)-1] // camel wins (ruling, see package comment)
}

func (b *queryBinder) stringSliceField(snake string) []string {
return b.raw(snake)
}

func (b *queryBinder) uint32Field(snake string) uint32 {
var out uint32
for _, raw := range b.scalar(snake) {
Expand Down
Loading
Loading