-
Notifications
You must be signed in to change notification settings - Fork 155
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
feat: add octo review browse to browse a pull request #830
base: master
Are you sure you want to change the base?
Conversation
Add a new command `Octo review browse` which opens the review layout for a PR but does not start a review. This is handy when you want to look over the changes in a PR but do not necessary want to review it. When you are in a Review layout initiated by `Octo review browse` you can intuitively convert it into an active review session with `Octo review start`. Its invalid to call `Octo review browse` after `Octo review start` and the user must either submit or discard the active review to enter the browse state again. Closes: pwntester#829 Signed-off-by: ldelossa <[email protected]>
18cdd1a
to
6c2f501
Compare
Tested the draft version out. It's great, but agree about the commenting issue. Expected behavior would be for it to be just a non-review comment, or less expected but that it triggers first |
Very cool. What is the behavior when you (try to) add a comment while browsing? Does that automatically start a review? Or cause an error? Also, can |
gh.run { | ||
args = { "api", "graphql", "-f", string.format("query=%s", query) }, | ||
cb = function(output, stderr) | ||
if stderr and not utils.is_blank(stderr) then | ||
utils.error(stderr) | ||
elseif output then | ||
local resp = vim.fn.json_decode(output) | ||
callback(resp) | ||
end | ||
end, | ||
} |
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.
Interested in using the new pattern?
gh.api.graphql {
query = query,
opts = {
cb = cb,
},
}
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.
Definitely, that is very nice. Will update.
local file = io.open("/tmp/query", "w") | ||
file:write(query) | ||
file:close() |
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.
Is this just for testing?
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.
Yup 🤦
forgot about that. Ill remove.
as far as creating a comment via in "browse" state. For now, I think it will just create a notification asking you to start a review. Or, if we want, start a review automatically, but youd need to do a "Octo comment add" once again, since starting a review reloads the layout, and puts you at the first changed file. This maybe not where you wanted to comment. As a follow up, id like this to add a non-review commit! Theres some nuance to this however, since it, iirc from when I worked on this, requires the use of a separate set of APIs. So we need to work in some logic to say "hey is this a non-review commit, if so, use this api and not the review comments api". Id like this, but probably in a follow up pr? Thoughts? Re:
yup, that use case is implemented. From browse you can go right to start. From within a review, you cant go to browse. Youll need to submit or discard the current review. This makes things a bit simpler. |
I like the idea of not having to start a review in order to post a comment or browse diffs, very much so! I can't think of a good UX in the current octo way of doing things to seemlessly allow users to start reviews while creating comment, i'd like to avoid being prompted everytime we add a comment. The best idea I have right now is that when a user runs
And let the user start a review if they wish to do so using WDYT ? While we're touching this part of the code, do you think this can address #823 ? |
I totally agree. Ultimately I think 'Octo command add' in the 'browse' state should add a non-review commit. I was thinking of this PR just providing the initial implementation of the feature, and then following up with API changes to handle "browse state comments". Would you rather see it all done in one PR here? I'm not too opposed, would just take a bit longer to get the |
I am fine with iterating, as long as we do not hurt existing UX, which is not the case here. Btw it's still in draft but let me know if you want a review |
@GuillaumeLagrange sounds good. Yeah if we do not mind, ill probably submit this one without "non-review" comments, and then start working on making that work in a immediate subsequent PR. |
@ldelossa, would you like to convert the PR from draft to ready? I've been using this for two weeks, and really appreciate the feature. Pushing the non-review sounds good. |
@phdah I want to handle some error conditions when trying to apply comments when in browse mode. I'm a bit busy with day job right now, but will follow up on this next week. |
Add a new command
Octo review browse
which opens the review layout for a PR but does not start a review.This is handy when you want to look over the changes in a PR but do not necessary want to review it.
When you are in a Review layout initiated by
Octo review browse
you can intuitively convert it into an active review session withOcto review start
.Its invalid to call
Octo review browse
afterOcto review start
and the user must either submit or discard the active review to enter the browse state again.Closes: #829
Describe what this PR does / why we need it
Provides the ability to browse a PR but not enter a review
A big reason to do this is say, you already submitted a review, but you want to use the (very nice) Review layout to continue looking at other contributor's comments.
Does this pull request fix one issue?
#829
Describe how you did it
Copied the patterns used for
Octo review start
but instead of submitting graphql mutations to start a review, we simply just get the review threads and initialize the review layout. The abstractions are well done, so this was clean and done without much trouble.Describe how to verify it
Open a PR with
Octo pr edit|list
and issueOcto review browse
you can then ensure starting a review from the browse state is working withOcto review start
.Special notes for reviews
Checklist