Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Make review comments editable - #2124

Merged
vanessayuenn merged 93 commits into
masterfrom
ku-edit-comments
May 15, 2019
Merged

Make review comments editable#2124
vanessayuenn merged 93 commits into
masterfrom
ku-edit-comments

Conversation

@kuychaco

@kuychacokuychaco commented May 4, 2019

Copy link
Copy Markdown
Contributor

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 Include the Checks API in build status #2102 (pending its merge)
  • Use unified relay query error reporting from Improve error handling when offline #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)

kuychacoand others added 30 commits May 3, 2019 14:38
So that it can manage its own edit state
still thinking about how to structure the explanation
…hat the comment went under a different list so they are not confused.
Co-Authored-By: vanessayuenn <6842965+vanessayuenn@users.noreply.github.com>
This will let cmd/ctrl-enter fire the github:submit-comment event for review summary editors and existing comment editors, too.
Without this, the "edited" flair doesn't appear on a review comment or summary you edit until you perform a full refetch.
We added a few fields to PullRequestReview and PullRequestReviewComment, so we need to specify some defaults.
@codecov

codecovBot commented May 10, 2019

Copy link
Copy Markdown

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 FilesCoverage Δ
lib/containers/reviews-container.js100% <ø> (ø)⬆️
...ainers/accumulators/review-comments-accumulator.js100% <ø> (ø)⬆️
lib/items/reviews-item.js100% <ø> (ø)⬆️
...iners/accumulators/review-summaries-accumulator.js100% <ø> (ø)⬆️
lib/controllers/root-controller.js82.87% <ø> (ø)⬆️
lib/views/actionable-review-view.js100% <100%> (ø)
lib/views/review-comment-view.js100% <100%> (ø)
lib/controllers/reviews-controller.js100% <100%> (ø)⬆️
lib/views/reviews-view.js87.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.

smashwilsonand others added 13 commits May 10, 2019 11:10
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.
This lets us inject mocks to test menu actions without having to do any crazy Electron shenanigans.
I've got everything but the cancel button tests.
@vanessayuenn
vanessayuenn marked this pull request as ready for review May 13, 2019 15:43
kuychacoand others added 2 commits May 14, 2019 14:59
Co-Authored-By: Ash Wilson <smashwilson@gmail.com>
Co-Authored-By: Ash Wilson <smashwilson@gmail.com>

@kuychacokuychaco left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

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"

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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

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 masterMay 15, 2019
@vanessayuenn
vanessayuenn deleted the ku-edit-comments branch May 15, 2019 18:34
This was referenced Jul 16, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@kuychaco@smashwilson@rsese@vanessayuenn