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

Make review comments editable #2124

Merged
merged 93 commits into from May 15, 2019

Conversation

@kuychaco
Copy link
Member

commented May 4, 2019

Starting work to address #2112. Will add writeup shortly!

Please be sure to read the contributor's guide to the GitHub package before submitting any pull requests.

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • Suggestion: You can use checklists to keep track of progress for the sections on metrics, tests, documentation, and user research.

Description of the Change

  • Editable review comments
  • Editable review summaries
  • Focus on textbox when editing is enabled
  • Keyboard shortcut (cmd+enter to submit and esc to cancel)
  • Use the markdown parsing bits from #2102 (pending its merge)
  • Use unified relay query error reporting from #2128 (pending its merge)
  • Include "edited" state in the response from the edit mutations and optimistic results
  • Only show the edit option if user has permission
  • Test coverage

Screenshot/Gif

Alternate Designs

Benefits

Possible Drawbacks

Applicable Issues

Metrics

Tests

Documentation

Release Notes

User Experience Research (Optional)

@vanessayuenn vanessayuenn added this to In progress in PR review author feature May 7, 2019

smashwilson added some commits May 10, 2019

Broaden the keymap selector used to bind github:submit-comment
This will let cmd/ctrl-enter fire the github:submit-comment event for 
review summary editors and existing comment editors, too.
Include lastEditedAt in mutation responses
Without this, the "edited" flair doesn't appear on a review comment or 
summary you edit until you perform a full refetch.
Populate missing GraphQL builder fields
We added a few fields to PullRequestReview and PullRequestReviewComment, 
so we need to specify some defaults.
@codecov

This comment has been minimized.

Copy link

commented May 10, 2019

Codecov Report

Merging #2124 into master will increase coverage by 0.04%.
The diff coverage is 98.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2124      +/-   ##
==========================================
+ Coverage   92.68%   92.72%   +0.04%     
==========================================
  Files         213      215       +2     
  Lines       12188    12269      +81     
  Branches     1788     1796       +8     
==========================================
+ Hits        11296    11376      +80     
- Misses        892      893       +1
Impacted Files Coverage Δ
lib/containers/reviews-container.js 100% <ø> (ø) ⬆️
...ainers/accumulators/review-comments-accumulator.js 100% <ø> (ø) ⬆️
lib/items/reviews-item.js 100% <ø> (ø) ⬆️
...iners/accumulators/review-summaries-accumulator.js 100% <ø> (ø) ⬆️
lib/controllers/root-controller.js 82.87% <ø> (ø) ⬆️
lib/views/actionable-review-view.js 100% <100%> (ø)
lib/views/review-comment-view.js 100% <100%> (ø)
lib/controllers/reviews-controller.js 100% <100%> (ø) ⬆️
lib/views/reviews-view.js 87.11% <80%> (-0.69%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14079a6...8e4b08f. Read the comment docs.

smashwilson and others added some commits May 10, 2019

Update ReviewsController action method behavior to match the tests
I've removed the callback parameter - using Promise fulfillment will be 
cleaner - and made the update methods re-throw caught mutation errors. 
I've also updated the callsite in ActionableReviewView to use await and 
try/catch to manage editing state. Now if the update mutation fails, 
users won't lose their edits.
Pluggable Menu and MenuItem creation
This lets us inject mocks to test menu actions without having to do any 
crazy Electron shenanigans.
The Story So Far
I've got everything but the cancel button tests.

@vanessayuenn vanessayuenn marked this pull request as ready for review May 13, 2019

kuychaco and others added some commits May 14, 2019

Merge branch 'master' into ku-edit-comments
Co-Authored-By: Ash Wilson <smashwilson@gmail.com>
Finish converting `reportMutationErrors` to `reportRelayError`
Co-Authored-By: Ash Wilson <smashwilson@gmail.com>
@kuychaco
Copy link
Member Author

left a comment

Looks great to me! Left a couple of comments, nothing blocking.

If I weren't the PR author I'd submit this with an "Approve"

lib/views/review-comment-view.js Outdated Show resolved Hide resolved
await this.props.contentUpdater(this.props.originalContent.id, text);
this.setState({editing: false});
} catch (e) {
this.buffer.setText(text);

This comment has been minimized.

Copy link
@kuychaco

kuychaco May 15, 2019

Author Member

So we'd get to this catch block when the update mutation fails, and if I'm understanding Relay mutations correctly then the optimistic update will automatically get rolled back, and the original text will be restored to the buffer. So I think it may not be necessary to manually restore the text here... though I guess it couldn't hurt to do so and be 100%.

@vanessayuenn vanessayuenn merged commit f650f69 into master May 15, 2019

14 of 17 checks passed

Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
atom.github Build #20190515.2 succeeded
Details
atom.github (Lint) Lint succeeded
Details
atom.github (Linux beta) Linux beta succeeded
Details
atom.github (Linux dev) Linux dev succeeded
Details
atom.github (Linux stable) Linux stable succeeded
Details
atom.github (MacOS beta) MacOS beta succeeded
Details
atom.github (MacOS dev) MacOS dev succeeded
Details
atom.github (MacOS stable) MacOS stable succeeded
Details
atom.github (Snapshot) Snapshot succeeded
Details
atom.github (Windows beta) Windows beta succeeded
Details
atom.github (Windows dev) Windows dev succeeded
Details
atom.github (Windows stable) Windows stable succeeded
Details
codecov/patch 98.85% of diff hit (target 92.68%)
Details
codecov/project 92.72% (+0.04%) compared to 14079a6
Details

Release : 9 May 2019 - 5 June 2019 : v0.30.0 automation moved this from In progress to Merged May 15, 2019

@vanessayuenn vanessayuenn deleted the ku-edit-comments branch May 15, 2019

@smashwilson smashwilson moved this from In progress to Done in PR review author feature May 15, 2019

This was referenced Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.