Skip to content

Commit 097bad6

Browse files
authored
Merge pull request cli#12783 from srt32/fix-assignee-databaseid
Add databaseId to assignees GraphQL fragment
2 parents cf862d6 + 34c3b3c commit 097bad6

3 files changed

Lines changed: 55 additions & 3 deletions

File tree

api/export_pr_test.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,32 @@ func TestIssue_ExportData(t *testing.T) {
107107
}
108108
`),
109109
},
110+
{
111+
name: "assignees",
112+
fields: []string{"assignees"},
113+
inputJSON: heredoc.Doc(`
114+
{ "assignees": { "nodes": [
115+
{
116+
"id": "MDQ6VXNlcjE=",
117+
"login": "monalisa",
118+
"name": "Mona Lisa",
119+
"databaseId": 1234
120+
}
121+
] } }
122+
`),
123+
outputJSON: heredoc.Doc(`
124+
{
125+
"assignees": [
126+
{
127+
"id": "MDQ6VXNlcjE=",
128+
"login": "monalisa",
129+
"name": "Mona Lisa",
130+
"databaseId": 1234
131+
}
132+
]
133+
}
134+
`),
135+
},
110136
{
111137
name: "linked pull requests",
112138
fields: []string{"closedByPullRequestsReferences"},
@@ -316,6 +342,32 @@ func TestPullRequest_ExportData(t *testing.T) {
316342
}
317343
`),
318344
},
345+
{
346+
name: "assignees",
347+
fields: []string{"assignees"},
348+
inputJSON: heredoc.Doc(`
349+
{ "assignees": { "nodes": [
350+
{
351+
"id": "MDQ6VXNlcjE=",
352+
"login": "monalisa",
353+
"name": "Mona Lisa",
354+
"databaseId": 1234
355+
}
356+
] } }
357+
`),
358+
outputJSON: heredoc.Doc(`
359+
{
360+
"assignees": [
361+
{
362+
"id": "MDQ6VXNlcjE=",
363+
"login": "monalisa",
364+
"name": "Mona Lisa",
365+
"databaseId": 1234
366+
}
367+
]
368+
}
369+
`),
370+
},
319371
{
320372
name: "linked issues",
321373
fields: []string{"closingIssuesReferences"},

api/query_builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ func IssueGraphQL(fields []string) string {
388388
case "headRepository":
389389
q = append(q, `headRepository{id,name}`)
390390
case "assignees":
391-
q = append(q, `assignees(first:100){nodes{id,login,name},totalCount}`)
391+
q = append(q, `assignees(first:100){nodes{id,login,name,databaseId},totalCount}`)
392392
case "assignedActors":
393393
q = append(q, assignedActors)
394394
case "labels":

api/query_builder_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestPullRequestGraphQL(t *testing.T) {
2121
{
2222
name: "fields with nested structures",
2323
fields: []string{"author", "assignees"},
24-
want: "author{login,...on User{id,name}},assignees(first:100){nodes{id,login,name},totalCount}",
24+
want: "author{login,...on User{id,name}},assignees(first:100){nodes{id,login,name,databaseId},totalCount}",
2525
},
2626
{
2727
name: "compressed query",
@@ -67,7 +67,7 @@ func TestIssueGraphQL(t *testing.T) {
6767
{
6868
name: "fields with nested structures",
6969
fields: []string{"author", "assignees"},
70-
want: "author{login,...on User{id,name}},assignees(first:100){nodes{id,login,name},totalCount}",
70+
want: "author{login,...on User{id,name}},assignees(first:100){nodes{id,login,name,databaseId},totalCount}",
7171
},
7272
{
7373
name: "compressed query",

0 commit comments

Comments
 (0)