Skip to content

check for disabled issues in issue view#240

Merged
vilmibm merged 3 commits intomasterfrom
disabled-issue-preview
Jan 22, 2020
Merged

check for disabled issues in issue view#240
vilmibm merged 3 commits intomasterfrom
disabled-issue-preview

Conversation

@vilmibm
Copy link
Copy Markdown
Contributor

@vilmibm vilmibm commented Jan 21, 2020

closes #226

this PR adds another graphql query to gh issue view to ensure that a repo actually has issues
enabled before trying to query issues.

~/s/testing $ gh issue view 16
the 'vilmibm/testing' repository has disabled issues

@vilmibm vilmibm requested a review from mislav January 21, 2020 21:51
Copy link
Copy Markdown
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for handling this!

This smells to me like a bug in our API: if a repository has issues disabled, how come it lets us query specific issues from within it? But in any case, we have to work around it.

command/issue.go Outdated
return err
}

issuesEnabled, err := api.HasIssuesEnabled(apiClient, baseRepo)
Copy link
Copy Markdown
Contributor

@mislav mislav Jan 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! But I'm wondering whether we can avoid making this additional query every time? Using GraphQL, we can request extra information in existing queries.

For instance, this is done right before an issueFromArg(). In that call, we call api.IssueByNumber() to check if an issue exists. Within that call, we could add the hasIssuesEnabled field to repository and return an error if it returned false. That way we save ourselves an extra round trip to the server.

If this idea doesn't seem clear to you, let me know and we can try doing this together!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's clear. i have an impulse to have more clear and specific API helper functions but in retrospect that goes against the spirit of graphql :( i can retool for that.

@vilmibm
Copy link
Copy Markdown
Contributor Author

vilmibm commented Jan 22, 2020

ok, ready for a re-review @mislav

Copy link
Copy Markdown
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! Thank you for following up 🎉

@vilmibm vilmibm merged commit 5965698 into master Jan 22, 2020
@mislav mislav deleted the disabled-issue-preview branch January 22, 2020 23:00
mislav pushed a commit that referenced this pull request Jan 23, 2020
check for disabled issues in issue view
cchristous pushed a commit to cchristous/cli that referenced this pull request Feb 28, 2026
* feat: Project tasks support reference object

* fix: show only reference or only branch

* fix: failing test and introduce additional cases

* fix: extract reference deconstruction

* Update api/models/project_v1_alpha.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update api/models/project_v1_alpha.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block issue preview if Issues disabled

2 participants