Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Fix draft appearing after sucessful submit. #2027

Merged
merged 2 commits into from
Nov 5, 2018

Conversation

grokys
Copy link
Contributor

@grokys grokys commented Nov 2, 2018

In certain situations, the inline comment thread was refreshed before the DeleteDraft(comment) line in PullRequestReviewCommentThreadViewModel.PostComment was run, meaning that the draft would be displayed after the comment was succesfully submitted, causing a situation like this:

image

Work around this by deleting the draft before submitting the comment, and if we get an error re-insert the draft.

Bonus fix: Don't save drafts of empty comments.

In certain situations, the inline comment thread was refreshed before the `DeleteDraft(comment)` line in `PullRequestReviewCommentThreadViewModel.PostComment` was run, meaning that the draft would be displayed _after_ the comment was succesfully submitted.

Work around this by deleting the draft before submitting the comment, and if we get an error re-insert the draft.
@codecov
Copy link

codecov bot commented Nov 2, 2018

Codecov Report

Merging #2027 into master will decrease coverage by 1.44%.
The diff coverage is 51.51%.

@@            Coverage Diff             @@
##           master    #2027      +/-   ##
==========================================
- Coverage   40.72%   39.28%   -1.45%     
==========================================
  Files         377      410      +33     
  Lines       16325    17585    +1260     
  Branches     2245     2435     +190     
==========================================
+ Hits         6649     6908     +259     
- Misses       9144    10120     +976     
- Partials      532      557      +25
Impacted Files Coverage Δ
...wModels/PullRequestReviewCommentThreadViewModel.cs 78.37% <51.51%> (-11.92%) ⬇️
...nlineReviews/Services/PullRequestSessionManager.cs 82.74% <0%> (-1.02%) ⬇️
...c/GitHub.InlineReviews/Tags/InlineCommentTagger.cs 79.64% <0%> (-0.89%) ⬇️
...nlineReviews/Services/PullRequestSessionService.cs 16.7% <0%> (-0.41%) ⬇️
...rc/GitHub.VisualStudio/Commands/OpenLinkCommand.cs 0% <0%> (ø)
...Hub.VisualStudio/Commands/ShowGitHubPaneCommand.cs 0% <0%> (ø)
...o/Commands/GoToSolutionOrPullRequestFileCommand.cs 0% <0%> (ø)
src/GitHub.VisualStudio/Services/UsageTracker.cs 92.53% <0%> (ø)
.../GitHub.VisualStudio/Services/ShowDialogService.cs 0% <0%> (ø)
...Hub.VisualStudio/Commands/ShowMessageBoxCommand.cs 0% <0%> (ø)
... and 27 more

@meaghanlewis
Copy link
Contributor

This LGTM 👍

Copy link
Collaborator

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

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

The duplicate messages appear to be gone! LGTM

@jcansdale jcansdale merged commit 8cea51b into master Nov 5, 2018
@jcansdale jcansdale deleted the fixes/draft-appears-after-submit branch November 5, 2018 20:57
@meaghanlewis meaghanlewis added this to the 2.5.9 milestone Nov 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants