diff --git a/api/queries_issue.go b/api/queries_issue.go index 54aab484f..401920e1b 100644 --- a/api/queries_issue.go +++ b/api/queries_issue.go @@ -2,13 +2,12 @@ package api import ( "fmt" - "time" ) type IssuesPayload struct { Assigned []Issue Mentioned []Issue - Recent []Issue + Authored []Issue } type Issue struct { @@ -91,11 +90,11 @@ func IssueStatus(client *Client, ghRepo Repo, currentUsername string) (*IssuesPa type response struct { Assigned apiIssues Mentioned apiIssues - Recent apiIssues + Authored apiIssues } query := fragments + ` - query($owner: String!, $repo: String!, $since: DateTime!, $viewer: String!, $per_page: Int = 10) { + query($owner: String!, $repo: String!, $viewer: String!, $per_page: Int = 10) { assigned: repository(owner: $owner, name: $repo) { issues(filterBy: {assignee: $viewer, states: OPEN}, first: $per_page, orderBy: {field: CREATED_AT, direction: DESC}) { nodes { @@ -110,8 +109,8 @@ func IssueStatus(client *Client, ghRepo Repo, currentUsername string) (*IssuesPa } } } - recent: repository(owner: $owner, name: $repo) { - issues(filterBy: {since: $since, states: OPEN}, first: $per_page, orderBy: {field: CREATED_AT, direction: DESC}) { + authored: repository(owner: $owner, name: $repo) { + issues(filterBy: {createdBy: $viewer, states: OPEN}, first: $per_page, orderBy: {field: CREATED_AT, direction: DESC}) { nodes { ...issue } @@ -122,12 +121,10 @@ func IssueStatus(client *Client, ghRepo Repo, currentUsername string) (*IssuesPa owner := ghRepo.RepoOwner() repo := ghRepo.RepoName() - since := time.Now().UTC().Add(time.Hour * -24).Format("2006-01-02T15:04:05-0700") variables := map[string]interface{}{ "owner": owner, "repo": repo, "viewer": currentUsername, - "since": since, } var resp response @@ -139,7 +136,7 @@ func IssueStatus(client *Client, ghRepo Repo, currentUsername string) (*IssuesPa payload := IssuesPayload{ Assigned: resp.Assigned.Issues.Nodes, Mentioned: resp.Mentioned.Issues.Nodes, - Recent: resp.Recent.Issues.Nodes, + Authored: resp.Authored.Issues.Nodes, } return &payload, nil diff --git a/command/issue.go b/command/issue.go index 7a5a1b086..4fc937a1e 100644 --- a/command/issue.go +++ b/command/issue.go @@ -158,11 +158,11 @@ func issueStatus(cmd *cobra.Command, args []string) error { } fmt.Println() - printHeader("Recent issues") - if len(issuePayload.Recent) > 0 { - printIssues(" ", issuePayload.Recent...) + printHeader("Issues opened by you") + if len(issuePayload.Authored) > 0 { + printIssues(" ", issuePayload.Authored...) } else { - printMessage(" There are no recent issues") + printMessage(" There are no issues opened by you") } fmt.Println() diff --git a/test/fixtures/issueStatus.json b/test/fixtures/issueStatus.json index 37d0818da..f9e831c7a 100644 --- a/test/fixtures/issueStatus.json +++ b/test/fixtures/issueStatus.json @@ -28,7 +28,7 @@ ] } }, - "recent": { + "authored": { "issues": { "nodes": [] }