@@ -2,13 +2,12 @@ package api
22
33import (
44 "fmt"
5- "time"
65)
76
87type IssuesPayload struct {
98 Assigned []Issue
109 Mentioned []Issue
11- Recent []Issue
10+ Authored []Issue
1211}
1312
1413type Issue struct {
@@ -91,11 +90,11 @@ func IssueStatus(client *Client, ghRepo Repo, currentUsername string) (*IssuesPa
9190 type response struct {
9291 Assigned apiIssues
9392 Mentioned apiIssues
94- Recent apiIssues
93+ Authored apiIssues
9594 }
9695
9796 query := fragments + `
98- query($owner: String!, $repo: String!, $since: DateTime!, $ viewer: String!, $per_page: Int = 10) {
97+ query($owner: String!, $repo: String!, $viewer: String!, $per_page: Int = 10) {
9998 assigned: repository(owner: $owner, name: $repo) {
10099 issues(filterBy: {assignee: $viewer, states: OPEN}, first: $per_page, orderBy: {field: CREATED_AT, direction: DESC}) {
101100 nodes {
@@ -110,8 +109,8 @@ func IssueStatus(client *Client, ghRepo Repo, currentUsername string) (*IssuesPa
110109 }
111110 }
112111 }
113- recent : repository(owner: $owner, name: $repo) {
114- issues(filterBy: {since : $since , states: OPEN}, first: $per_page, orderBy: {field: CREATED_AT, direction: DESC}) {
112+ authored : repository(owner: $owner, name: $repo) {
113+ issues(filterBy: {createdBy : $viewer , states: OPEN}, first: $per_page, orderBy: {field: CREATED_AT, direction: DESC}) {
115114 nodes {
116115 ...issue
117116 }
@@ -122,12 +121,10 @@ func IssueStatus(client *Client, ghRepo Repo, currentUsername string) (*IssuesPa
122121
123122 owner := ghRepo .RepoOwner ()
124123 repo := ghRepo .RepoName ()
125- since := time .Now ().UTC ().Add (time .Hour * - 24 ).Format ("2006-01-02T15:04:05-0700" )
126124 variables := map [string ]interface {}{
127125 "owner" : owner ,
128126 "repo" : repo ,
129127 "viewer" : currentUsername ,
130- "since" : since ,
131128 }
132129
133130 var resp response
@@ -139,7 +136,7 @@ func IssueStatus(client *Client, ghRepo Repo, currentUsername string) (*IssuesPa
139136 payload := IssuesPayload {
140137 Assigned : resp .Assigned .Issues .Nodes ,
141138 Mentioned : resp .Mentioned .Issues .Nodes ,
142- Recent : resp .Recent .Issues .Nodes ,
139+ Authored : resp .Authored .Issues .Nodes ,
143140 }
144141
145142 return & payload , nil
0 commit comments