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

Review creation #735

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Review creation #735

wants to merge 2 commits into from

Conversation

Tunous
Copy link
Collaborator

@Tunous Tunous commented Sep 16, 2017

No description provided.

@Tunous
Copy link
Collaborator Author

Tunous commented Sep 16, 2017

Right now this pull request is just a collection of ideas and I need help with some stuff.

I wanted to make review creation work like on GitHub web interface. That is: it should allow you to add comments one by one as pending and submit them at any time from any place (web or mobile).

The problem is that GitHub API doesn't provide a way to easily add new comments to pending review (Unless I missed that). It requires first to delete old pending review and then create new with all comments. You can see how I tested that here.

I feel like this approach is bad. If for some reason there was an error after old pending was deleted but before new was created the user could lose all their comments. Sadly I don't have ideas on how to work around this....

@Tunous Tunous changed the title WIP: Review creation Review creation Sep 23, 2017
@Tunous Tunous added the wip label Sep 23, 2017
@maniac103
Copy link
Collaborator

The problem is that GitHub API doesn't provide a way to easily add new comments to pending review (Unless I missed that). It requires first to delete old pending review and then create new with all comments. You can see how I tested that here.

FWIW, I don't see a way to do this either. May be worth asking Github support about it?

I feel like this approach is bad. If for some reason there was an error after old pending was deleted but before new was created the user could lose all their comments. Sadly I don't have ideas on how to work around this....

Yes, I agree, this approach is not ideal (and maybe could be improved by submitting the new review before deleting the old one and storing the ID of the to-be-deleted review persistently, so that even if we crash, we could ask the user for deletion of the duplicate review). Having proper API support for this would be much preferable though, so I'd try asking Github support first.

@Tunous
Copy link
Collaborator Author

Tunous commented Sep 26, 2017

and maybe could be improved by submitting the new review before deleting the old one and storing the ID of the to-be-deleted review persistently, so that even if we crash, we could ask the user for deletion of the duplicate review

I tried that and it doesn't work. It crashes saying that there can be only one pending review.

@maniac103
Copy link
Collaborator

I tried that and it doesn't work. It crashes saying that there can be only one pending review.

sigh Github support it is then?

@Tunous
Copy link
Collaborator Author

Tunous commented Sep 26, 2017

Yeah I'll ask them later

@Tunous
Copy link
Collaborator Author

Tunous commented Sep 27, 2017

I've sent the message, waiting for reply.

@Tunous Tunous removed the wip label Sep 27, 2017
@Tunous
Copy link
Collaborator Author

Tunous commented Sep 28, 2017

I've got a really great and detailed response from GitHub staff. In short, the answer is that it is possible to do what we are looking for by using GraphQL API.

I'll try to implement a test solution with all the information I've got. We would have to use this new API at some point anyway so it's good place to start.

@maniac103 any thoughts?

@Tunous
Copy link
Collaborator Author

Tunous commented Sep 29, 2017

I've pushed a commit with proof of concept implementation. With it, we can correctly create a new review or add new comments to existing review if it already exists.

Now the important part is the implementation of the GraphQL API library. I've used apollo-android for this as it seems to be the best (only?) option available currently. The actual usage is pretty messy and is missing proper error handling, lifecycle binding etc. but it should be easy to solve after we merge #698. Using rxJava here should remove a lot of boilerplate code and solve the mentioned issues.

Working with GraphQL API seems to be easy. The hardest part is finding stuff in documentation. After that, we can freely experiment in explorer, copy the created queries/mutations to code and use generated classes.

@maniac103 Check it out and let me know what you think.

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.

None yet

2 participants