X Tutup
Skip to content

Commit 3caa7cc

Browse files
committed
improve comments
1 parent f9b50ac commit 3caa7cc

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

api/queries_issue.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ func IssueList(client *Client, repo ghrepo.Interface, state string, labels []str
257257

258258
for i := range milestones {
259259
if strings.EqualFold(milestones[i].Title, milestoneString) {
260-
// The query for milestones requires the use of the milestone's database ID (see #1441)
261260
id, err := milestoneNodeIdToDatabaseId(milestones[i].ID)
262261
if err != nil {
263262
return nil, err
@@ -439,18 +438,18 @@ func IssueReopen(client *Client, repo ghrepo.Interface, issue Issue) error {
439438
}
440439

441440
// milestoneNodeIdToDatabaseId extracts the REST Database ID from the GraphQL Node ID
442-
func milestoneNodeIdToDatabaseId(id string) (string, error) {
443-
// The node id is base64 obfuscated
444-
decoded, err := base64.StdEncoding.DecodeString(id)
441+
// This conversion is necessary since the GraphQL API requires the use of the milestone's database ID
442+
// for querying the related issues.
443+
func milestoneNodeIdToDatabaseId(nodeId string) (string, error) {
444+
// The Node ID is Base64 obfuscated, with an underlying pattern:
445+
// "09:Milestone12345", where "12345" is the database ID
446+
decoded, err := base64.StdEncoding.DecodeString(nodeId)
445447
if err != nil {
446448
return "", err
447449
}
448-
449-
// The decoded node ID has a pattern like '09:Milestone12345'
450450
splitted := strings.Split(string(decoded), "Milestone")
451451
if len(splitted) != 2 {
452452
return "", fmt.Errorf("couldn't get database id from node id")
453453
}
454-
455454
return splitted[1], nil
456455
}

command/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ var issueCmd = &cobra.Command{
6161
$ gh issue list
6262
$ gh issue create --label bug
6363
$ gh issue view --web
64-
$ gh issue list --milestone 'MVP'
6564
`),
6665
Annotations: map[string]string{
6766
"IsCore": "true",
@@ -89,6 +88,7 @@ var issueListCmd = &cobra.Command{
8988
$ gh issue list -l "help wanted"
9089
$ gh issue list -A monalisa
9190
$ gh issue list --web
91+
$ gh issue list --milestone 'MVP'
9292
`),
9393
Args: cmdutil.NoArgsQuoteReminder,
9494
RunE: issueList,

0 commit comments

Comments
 (0)
X Tutup