Add mentioned flag

This commit is contained in:
Eddú Meléndez 2020-03-12 21:40:11 -06:00
parent 54e0534b1b
commit 2943703d4a
4 changed files with 20 additions and 9 deletions

View file

@ -198,7 +198,7 @@ func IssueStatus(client *Client, repo ghrepo.Interface, currentUsername string)
return &payload, nil
}
func IssueList(client *Client, repo ghrepo.Interface, state string, labels []string, assigneeString string, limit int, authorString string) (*IssuesAndTotalCount, error) {
func IssueList(client *Client, repo ghrepo.Interface, state string, labels []string, assigneeString string, limit int, authorString string, mentionedString string) (*IssuesAndTotalCount, error) {
var states []string
switch state {
case "open", "":
@ -215,7 +215,7 @@ func IssueList(client *Client, repo ghrepo.Interface, state string, labels []str
query($owner: String!, $repo: String!, $limit: Int, $endCursor: String, $states: [IssueState!] = OPEN, $labels: [String!], $assignee: String, $author: String) {
repository(owner: $owner, name: $repo) {
hasIssuesEnabled
issues(first: $limit, after: $endCursor, orderBy: {field: CREATED_AT, direction: DESC}, states: $states, labels: $labels, filterBy: {assignee: $assignee, createdBy: $author}) {
issues(first: $limit, after: $endCursor, orderBy: {field: CREATED_AT, direction: DESC}, states: $states, labels: $labels, filterBy: {assignee: $assignee, createdBy: $author, mentioned: $mentioned}) {
totalCount
nodes {
...issue
@ -243,6 +243,9 @@ func IssueList(client *Client, repo ghrepo.Interface, state string, labels []str
if authorString != "" {
variables["author"] = authorString
}
if mentionedString != "" {
variables["mentioned"] = mentionedString
}
var response struct {
Repository struct {

View file

@ -40,7 +40,7 @@ func TestIssueList(t *testing.T) {
`))
repo, _ := ghrepo.FromFullName("OWNER/REPO")
_, err := IssueList(client, repo, "open", []string{}, "", 251, "")
_, err := IssueList(client, repo, "open", []string{}, "", 251, "", "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}