pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.33k stars 125 forks source link

Fix create_thread_buffer #321

Closed ben-davis closed 2 years ago

ben-davis commented 2 years ago

Describe what this PR does / why we need it

Fixes creating thread buffers for existing comments.

When a comment is first created but before it's submitted, the thread object in Review:add_comment is stubbed with a valid value given for originalStartLine. ThreadPanel:create_thread_buffer then uses this to correctly render the thread.

But after submitting the comment, the response from the GH API doesn't include a value for originalStartLine for single-line comments, as mentioned here. This breaks the rendering in create_thread_buffer.

Does this pull request fix one issue?

Fixes #314

Describe how you did it

The fix was to fall back to thread.originalLine if thread.originalStartLine is set to vim.NIL.

Describe how to verify it

  1. Create and submit a new comment.
  2. Move the cursor over the comment.

Special notes for reviews

pwntester commented 2 years ago

Thanks for the PR!!