-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Added support for preview Lock Reason (#828) #910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1. Added preview media type 2. Added ActiveLockReason fields to Issue and PullRequest responses 3. Added LockReason(optional) to the IssuesService.Lock request 4. Added LockReason field to IssueEvent 5. Added and updated test cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great, @sandlis... thank you!
Just a few minor comments to address if you don't mind.
github/issues.go
Outdated
@@ -56,6 +56,8 @@ type Issue struct { | |||
// TextMatches is only populated from search results that request text matches | |||
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata | |||
TextMatches []TextMatch `json:"text_matches,omitempty"` | |||
|
|||
ActiveLockReason *string `json:"active_lock_reason,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add a descriptive comment here and enumerate the possible values.
github/issues_events.go
Outdated
// The Actor did that to the issue. | ||
// | ||
// locked | ||
// The Actor locked the issue. | ||
// lock_reason holds reason of locking the issue if provided while locking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Let's refer to the Go version of the field here (and make it a complete sentence for the godocs):
LockReason holds the reason of locking the issue (if provided while locking).
github/issues.go
Outdated
type LockIssueOptions struct { | ||
// LockReason specifies the reason to lock this issue. | ||
// Providing a lock reason can help make it clearer to contributors why an issue | ||
// was locked. Possible values are: off-topic, too heated, resolved, spam |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add quotes for clarity and end in period:
Possible values are: "off-topic", "too heated", "resolved", and "spam".
github/issues_test.go
Outdated
|
||
mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, "PUT") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a testHeader
here?
That makes it easier to maintain so that when the header is later removed, it is clear that this needs cleaning up here as well.
github/pulls.go
Outdated
@@ -62,6 +62,8 @@ type PullRequest struct { | |||
|
|||
Head *PullRequestBranch `json:"head,omitempty"` | |||
Base *PullRequestBranch `json:"base,omitempty"` | |||
|
|||
ActiveLockReason *string `json:"active_lock_reason,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a descriptive comment here as well with the possible values?
…quested in code review.
@gmlewis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after a couple tiny nits.
Thank you, @sandlis!
Awaiting second LGTM before merging.
github/issues.go
Outdated
@@ -56,6 +56,10 @@ type Issue struct { | |||
// TextMatches is only populated from search results that request text matches | |||
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata | |||
TextMatches []TextMatch `json:"text_matches,omitempty"` | |||
|
|||
// ActiveLockReason is populated only when LockReason is provided while locking the issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add period ('.') after issue.
github/pulls.go
Outdated
@@ -62,6 +62,10 @@ type PullRequest struct { | |||
|
|||
Head *PullRequestBranch `json:"head,omitempty"` | |||
Base *PullRequestBranch `json:"base,omitempty"` | |||
|
|||
// ActiveLockReason is populated only when LockReason is provided while locking the pull request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add trailing period after request.
@gmlewis Added period ('.') at mentioned places. |
@gmlewis |
Hi @sandlis, I just created a new NeedsReview label to inform contributors that they are welcome to review this PR. We rely on volunteers and sometimes PRs sit for a while before one of us can get to it. 😊 |
@gmlewis |
Sorry for the delay, @sandlis! I'm going to attempt to resolve the conflicts and merge this PR. |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
To integrate with go-github api changes that breaks the compiling: - google/go-github#910 - google/go-github#972 Change-Id: I5597f50b9c44fe42acec1128617a25e1fdd09e10 GitHub-Last-Rev: 07754f9 GitHub-Pull-Request: #11 Reviewed-on: https://go-review.googlesource.com/129075 Reviewed-by: Dmitri Shuralyov <[email protected]>
Done these changes based on responses that I received using github APIs.
Following were the APIs that I checked:
https://github.com/api/repos/sandlis/test/pulls/2
https://github.com/api/repos/sandlis/test/pulls
https://github.com/api/repos/sandlis/test/events
https://github.com/api/repos/sandlis/test/issues/1
https://github.com/api/repos/sandlis/test/issues
https://github.com/api/repos/sandlis/test/issues/events