Skip to content
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

add reactions for commit comments fixed #1302 #1325

Closed
wants to merge 21 commits into from

Conversation

martinscholz83
Copy link
Contributor

@martinscholz83 martinscholz83 commented May 25, 2016

Added feature to create reactions for commit comments.

To Do

  • Integration tests for observable client

Tests fails because of master branch!


client.CreateReaction("fake", "repo", 1, newCommitCommentReaction);

connection.Received().Post<CommitCommentReaction>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/comments/1/reactions"), Arg.Any<object>(), AcceptHeaders.Reactions);
Copy link
Contributor

Choose a reason for hiding this comment

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

You should hardcode the header string, so it serves as a sanity check against misspelling.

@M-Zuber
Copy link
Contributor

M-Zuber commented May 25, 2016

Overall looks pretty solid to me.
out of curiousity, @lrz-hal is your test account?

@martinscholz83
Copy link
Contributor Author

Jap,

@lrz-hal is my "now" my testaccount. I have run the integration tests 😄

@M-Zuber
Copy link
Contributor

M-Zuber commented May 25, 2016

When I first started contributing to octokit.net I did the same thing 😆

@M-Zuber
Copy link
Contributor

M-Zuber commented May 25, 2016

🎉
Looks great!!
although someone with more experience than me like @ryangribble should also have a look

@martinscholz83
Copy link
Contributor Author

Thanks!! If this looks good i will continue on reactions for other types like issues, ...

@ryangribble
Copy link
Contributor

Hi @maddin2016 many thanks for your first contribution!

In general everything looks pretty good. I do have an outstanding query with @shiftkey on the corresponding issue #1302, regarding his proposed design/location of these reaction calls as it seemed like putting them under each section (comment, commit, pull request, issue section, etc) is not inline with the github API docs/structure which I thought was a general goal/rule in octokit,net to stay as close to the official API as possible.

But in the meantime while we wait for an answer, we can work through the changes you've submitted and I'll highlight a few minor consistency/nitpick type things to get you familiar with contributing to the project 👍

Also as an FYI, when working on PR if you mention the magic words "fixes #1302 in your PR body, then when we merge the PR it will automatically mark the issue as closed... so it's a good habit to get into 😀

@@ -367,4 +367,62 @@ public void Dispose()
_context.Dispose();
}
}
public class TheReactionMethod : IDisposable
Copy link
Contributor

Choose a reason for hiding this comment

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

should insert one blank line in between class declarations

Copy link
Contributor

Choose a reason for hiding this comment

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

the name of the test class should reflect the name of the method. In this case the method is called CreateReaction so the test class should be called TheCreateReactionMethod

@martinscholz83
Copy link
Contributor Author

Hi @ryangribble. Many thanks. I'm very excited to make my first pull request for a project 😃 In the meantime i have created a new standalone ReactionClient where i implement a Delete Method like in #1303. Should i create a new branch and make a pull request. Or should i wait until this pull request is closed or adopted?

}

[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class CommitCommentReaction
Copy link
Contributor

Choose a reason for hiding this comment

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

This response object is returned for creating reactions on CommitComments, Issues, IssueComments and PullRequestReviewComments, so it should probably be called something more generic like Reaction rather than CommitCommentReaction

{
public enum Reaction
{
[Parameter(Value = "plus_one")]
Copy link
Contributor

Choose a reason for hiding this comment

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

The api doco seems to indicate the string is "+1" and "-1" for these, but you've got their API string value as plus_one and minus_one. Just checking if this was intentional?

@ryangribble
Copy link
Contributor

Feel free to discuss any of the feedback if you don't agree! I try to give detailed feedback around things, simply to get contributors into the groove of our approach/thinking. Sometimes this may come across as critical but that's not the intention! We appreciate all contributions and are very keen to work with you to ensure you have good experiences contributing to open source dotnet projects 😀

@martinscholz83
Copy link
Contributor Author

Ok. I will do this in the future. Thanks for all the suggestions

var newCommitCommentReaction = new NewCommitCommentReaction(Reaction.Confused);
var reaction = await _github.Repository.Comment.CreateReaction(_context.RepositoryOwner, _context.RepositoryName, result.Id, newCommitCommentReaction);

Assert.IsType<CommitCommentReaction>(reaction);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a good idea to assert the fields of the response message (eg confirm that the ReactionType you requested is what was actually set). Also given the other comment about plus_one vs +1 perhaps looping through all of the available ReactionType enum values and creating each one woudl be good, just to prove that all of them are defined correctly

@ryangribble
Copy link
Contributor

PS, with the "fixed #1302" tip i mentioned, even if you add that now (by editing your PR body) it will close the issue when the PR is merged.

@martinscholz83 martinscholz83 changed the title add reactions for commit comments add reactions for commit comments fixed #1302 May 26, 2016
@martinscholz83
Copy link
Contributor Author

martinscholz83 commented May 27, 2016

Another thing i would like to discuss. So far we have a request client NewCommitCommentReaction and a response client CommitCommentReaction. Would it not be better to have one request and one response client (eg NewReaction, Reaction) for all the different types? Because in the reactions doc https://developer.github.com/v3/reactions/ response and request are always the same for types.

@shiftkey
Copy link
Member

@maddin2016 yeah, I don't see the point in duplicating all the types here where they're structurally the same...

@martinscholz83
Copy link
Contributor Author

Any ideas for naming EnumReaction??

@ryangribble
Copy link
Contributor

ReactionType was my suggestion. That matches the terminology in API docs too...

Also the more we go through these specifics (request response types are common across all, there's only a single delete method for any reaction etc), the more I reckon it makes sense it all lives under a top level "Reactions" client.

If you're happy to do it, I'd love to see a PR providing that option so we can see how it feels

@martinscholz83
Copy link
Contributor Author

martinscholz83 commented May 27, 2016

Ok. Then i will start on this. I leave a comment for this topic #1302

@martinscholz83
Copy link
Contributor Author

Is there any experimental branch where i can create pull requests?

@ryangribble
Copy link
Contributor

Well all PR's are experimental until they are merged or abandoned so feel free to raise a PR for whatever you want

@shiftkey
Copy link
Member

shiftkey commented Jun 1, 2016

Closing this out in favour of #1335 which is going for the standalone client approach.

@shiftkey shiftkey closed this Jun 1, 2016
@martinscholz83 martinscholz83 deleted the reactions branch June 28, 2016 08:15
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.

4 participants