Skip to content

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

Merged
merged 6 commits into from
Aug 10, 2018

Conversation

sandeepsukhani
Copy link
Contributor

  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.

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

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.
@googlebot googlebot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label May 8, 2018
Copy link
Collaborator

@gmlewis gmlewis left a 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"`
Copy link
Collaborator

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.

// 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
Copy link
Collaborator

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
Copy link
Collaborator

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".


mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")

Copy link
Collaborator

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"`
Copy link
Collaborator

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?

@sandeepsukhani
Copy link
Contributor Author

@gmlewis
Thanks for the review!
I am done with requested changes.
Please review and let me know whether it looks good.

Copy link
Collaborator

@gmlewis gmlewis left a 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
Copy link
Collaborator

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
Copy link
Collaborator

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.

@sandeepsukhani
Copy link
Contributor Author

@gmlewis Added period ('.') at mentioned places.
Thanks!

@sandeepsukhani
Copy link
Contributor Author

@gmlewis
Do I need to invite someone for reviewing this or it gets picked up by mentors themselves as per their availability?
Sorry, this is my second contribution to this project, so I do not know how it works.
In my last PR, a request was sent for 2nd LGTM.

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label May 10, 2018
@gmlewis
Copy link
Collaborator

gmlewis commented May 10, 2018

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. 😊

@sandeepsukhani
Copy link
Contributor Author

@gmlewis
That should be helpful. Thanks!

@gmlewis
Copy link
Collaborator

gmlewis commented Aug 10, 2018

Sorry for the delay, @sandlis! I'm going to attempt to resolve the conflicts and merge this PR.

@googlebot
Copy link

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 cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@googlebot googlebot added cla: no and removed cla: yes Indication that the PR author has signed a Google Contributor License Agreement. labels Aug 10, 2018
@gmlewis gmlewis merged commit aeb5071 into google:master Aug 10, 2018
gmlewis pushed a commit to gmlewis/go-github that referenced this pull request Aug 10, 2018
gopherbot pushed a commit to golang/build that referenced this pull request Aug 17, 2018
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]>
n1lesh pushed a commit to n1lesh/go-github that referenced this pull request Oct 2, 2020
@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants