Rename to mention

This commit is contained in:
Eddú Meléndez 2020-06-15 15:58:07 -05:00
parent 8a96299735
commit cffd56f717
3 changed files with 11 additions and 11 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, mentionedString string, milestoneString string) (*IssuesAndTotalCount, error) {
func IssueList(client *Client, repo ghrepo.Interface, state string, labels []string, assigneeString string, limit int, authorString string, mentionString string, milestoneString string) (*IssuesAndTotalCount, error) {
var states []string
switch state {
case "open", "":
@ -212,10 +212,10 @@ func IssueList(client *Client, repo ghrepo.Interface, state string, labels []str
}
query := fragments + `
query($owner: String!, $repo: String!, $limit: Int, $endCursor: String, $states: [IssueState!] = OPEN, $labels: [String!], $assignee: String, $author: String, $mentioned: String, $milestone: String) {
query($owner: String!, $repo: String!, $limit: Int, $endCursor: String, $states: [IssueState!] = OPEN, $labels: [String!], $assignee: String, $author: String, $mention: String, $milestone: 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, mentioned: $mentioned, milestone: $milestone}) {
issues(first: $limit, after: $endCursor, orderBy: {field: CREATED_AT, direction: DESC}, states: $states, labels: $labels, filterBy: {assignee: $assignee, createdBy: $author, mentioned: $mention, milestone: $milestone}) {
totalCount
nodes {
...issue
@ -243,8 +243,8 @@ func IssueList(client *Client, repo ghrepo.Interface, state string, labels []str
if authorString != "" {
variables["author"] = authorString
}
if mentionedString != "" {
variables["mentioned"] = mentionedString
if mentionString != "" {
variables["mention"] = mentionString
}
if milestoneString != "" {
variables["milestone"] = milestoneString

View file

@ -41,7 +41,7 @@ func init() {
issueListCmd.Flags().StringP("state", "s", "open", "Filter by state: {open|closed|all}")
issueListCmd.Flags().IntP("limit", "L", 30, "Maximum number of issues to fetch")
issueListCmd.Flags().StringP("author", "A", "", "Filter by author")
issueListCmd.Flags().StringP("mentioned", "", "", "Filter by mention")
issueListCmd.Flags().StringP("mention", "", "", "Filter by mention")
issueListCmd.Flags().StringP("milestone", "", "", "Filter by milestone")
issueCmd.AddCommand(issueViewCmd)
@ -143,7 +143,7 @@ func issueList(cmd *cobra.Command, args []string) error {
return err
}
mentioned, err := cmd.Flags().GetString("mentioned")
mention, err := cmd.Flags().GetString("mention")
if err != nil {
return err
}
@ -153,7 +153,7 @@ func issueList(cmd *cobra.Command, args []string) error {
return err
}
listResult, err := api.IssueList(apiClient, baseRepo, state, labels, assignee, limit, author, mentioned, milestone)
listResult, err := api.IssueList(apiClient, baseRepo, state, labels, assignee, limit, author, mention, milestone)
if err != nil {
return err
}

View file

@ -153,7 +153,7 @@ func TestIssueList_withFlags(t *testing.T) {
} } }
`))
output, err := RunCommand("issue list -a probablyCher -l web,bug -s open -A foo --mentioned me --milestone 1.x")
output, err := RunCommand("issue list -a probablyCher -l web,bug -s open -A foo --mention me --milestone 1.x")
if err != nil {
t.Errorf("error running command `issue list`: %v", err)
}
@ -171,7 +171,7 @@ No issues match your search in OWNER/REPO
Labels []string
States []string
Author string
Mentioned string
Mention string
Milestone string
}
}{}
@ -181,7 +181,7 @@ No issues match your search in OWNER/REPO
eq(t, reqBody.Variables.Labels, []string{"web", "bug"})
eq(t, reqBody.Variables.States, []string{"OPEN"})
eq(t, reqBody.Variables.Author, "foo")
eq(t, reqBody.Variables.Mentioned, "me")
eq(t, reqBody.Variables.Mention, "me")
eq(t, reqBody.Variables.Milestone, "1.x")
}