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

Commit fc3c14b

Browse files
authored
Merge branch 'master' into refactor/pr-list-0.6-update
2 parents b13fd61 + 541e3ba commit fc3c14b

File tree

12 files changed

+49
-35
lines changed

12 files changed

+49
-35
lines changed

src/GitHub.InlineReviews/GitHub.InlineReviews.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,9 @@
404404
<HintPath>..\..\packages\Rx-PlatformServices.2.2.5-custom\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
405405
<Private>True</Private>
406406
</Reference>
407+
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
408+
<HintPath>..\..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
409+
</Reference>
407410
<Reference Include="System.Windows.Forms" />
408411
<Reference Include="System.Xaml" />
409412
<Reference Include="System.Xml" />

src/GitHub.InlineReviews/Services/PullRequestSessionService.cs

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -434,23 +434,12 @@ public async Task<PullRequestDetailModel> CreatePendingReview(
434434
{
435435
var address = HostAddress.Create(localRepository.CloneUrl.Host);
436436
var graphql = await graphqlFactory.CreateConnection(address);
437+
var (_, owner, number) = await CreatePendingReviewCore(localRepository, pullRequestId);
438+
var detail = await ReadPullRequestDetail(address, owner, localRepository.Name, number);
437439

438-
var review = new AddPullRequestReviewInput
439-
{
440-
PullRequestId = new ID(pullRequestId),
441-
};
442-
443-
var mutation = new Mutation()
444-
.AddPullRequestReview(review)
445-
.Select(x => new
446-
{
447-
x.PullRequestReview.Repository.Owner.Login,
448-
x.PullRequestReview.PullRequest.Number
449-
});
450-
451-
var result = await graphql.Run(mutation);
452440
await usageTracker.IncrementCounter(x => x.NumberOfPRReviewDiffViewInlineCommentStartReview);
453-
return await ReadPullRequestDetail(address, result.Login, localRepository.Name, result.Number);
441+
442+
return detail;
454443
}
455444

456445
/// <inheritdoc/>
@@ -652,9 +641,9 @@ public async Task<PullRequestDetailModel> PostStandaloneReviewCommentReply(
652641
string body,
653642
string inReplyTo)
654643
{
655-
var review = await CreatePendingReview(localRepository, pullRequestId);
656-
var comment = await PostPendingReviewCommentReply(localRepository, review.Id, body, inReplyTo);
657-
return await SubmitPendingReview(localRepository, review.Id, null, PullRequestReviewEvent.Comment);
644+
var (id, _, _) = await CreatePendingReviewCore(localRepository, pullRequestId);
645+
var comment = await PostPendingReviewCommentReply(localRepository, id, body, inReplyTo);
646+
return await SubmitPendingReview(localRepository, id, null, PullRequestReviewEvent.Comment);
658647
}
659648

660649
/// <inheritdoc/>
@@ -702,6 +691,29 @@ public async Task<PullRequestDetailModel> EditComment(ILocalRepositoryModel loca
702691
return await ReadPullRequestDetail(address, result.Login, localRepository.Name, result.Number);
703692
}
704693

694+
async Task<(string id, string owner, int number)> CreatePendingReviewCore(ILocalRepositoryModel localRepository, string pullRequestId)
695+
{
696+
var address = HostAddress.Create(localRepository.CloneUrl.Host);
697+
var graphql = await graphqlFactory.CreateConnection(address);
698+
699+
var input = new AddPullRequestReviewInput
700+
{
701+
PullRequestId = new ID(pullRequestId),
702+
};
703+
704+
var mutation = new Mutation()
705+
.AddPullRequestReview(input)
706+
.Select(x => new
707+
{
708+
Id = x.PullRequestReview.Id.Value,
709+
Owner = x.PullRequestReview.Repository.Owner.Login,
710+
x.PullRequestReview.PullRequest.Number
711+
});
712+
713+
var result = await graphql.Run(mutation);
714+
return (result.Id, result.Owner, result.Number);
715+
}
716+
705717
int GetUpdatedLineNumber(IInlineCommentThreadModel thread, IEnumerable<DiffChunk> diff)
706718
{
707719
var line = DiffUtilities.Match(diff, thread.DiffMatch);
@@ -724,7 +736,7 @@ Task<IRepository> GetRepository(ILocalRepositoryModel repository)
724736
static void BuildPullRequestThreads(PullRequestDetailModel model)
725737
{
726738
var commentsByReplyId = new Dictionary<string, List<CommentAdapter>>();
727-
739+
728740
// Get all comments that are not replies.
729741
foreach (CommentAdapter comment in model.Reviews.SelectMany(x => x.Comments))
730742
{
@@ -744,7 +756,6 @@ static void BuildPullRequestThreads(PullRequestDetailModel model)
744756
if (commentsByReplyId.TryGetValue(comment.ReplyTo, out thread))
745757
{
746758
thread.Add(comment);
747-
break;
748759
}
749760
}
750761
}

src/GitHub.InlineReviews/Views/CommentView.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@
154154
Text="{Binding Body, UpdateSourceTrigger=PropertyChanged}"
155155
TextWrapping="Wrap"
156156
VerticalAlignment="Center"
157-
GotFocus="ReplyPlaceholder_GotFocus">
157+
GotFocus="ReplyPlaceholder_GotFocus"
158+
SpellCheck.IsEnabled="True">
158159
<ui:PromptTextBox.Style>
159160
<Style TargetType="ui:PromptTextBox" BasedOn="{StaticResource RoundedPromptTextBox}">
160161
<Setter Property="Foreground" Value="{DynamicResource GitHubVsToolWindowText}" />

src/GitHub.InlineReviews/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<package id="Rx-PlatformServices" version="2.2.5-custom" targetFramework="net461" />
4343
<package id="Serilog" version="2.5.0" targetFramework="net461" />
4444
<package id="SerilogAnalyzer" version="0.12.0.0" targetFramework="net461" />
45+
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
4546
<package id="VSSDK.ComponentModelHost" version="12.0.4" targetFramework="net461" />
4647
<package id="VSSDK.IDE.12" version="12.0.4" targetFramework="net461" />
4748
</packages>

src/GitHub.UI/Assets/Controls.xaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@
1919
Styles for standard windows controls
2020
-->
2121

22-
<ContextMenu x:Key="DefaultContextMenu">
23-
<MenuItem Header="Cut" Command="ApplicationCommands.Cut"/>
24-
<MenuItem Header="Copy" Command="ApplicationCommands.Copy"/>
25-
<MenuItem Header="Paste" Command="ApplicationCommands.Paste"/>
26-
</ContextMenu>
27-
<!--End ContextMenu-->
28-
2922
<!-- ProgressBar -->
3023
<Style x:Key="GitHubProgressBar" TargetType="{x:Type ui:GitHubProgressBar}">
3124
<Setter Property="Foreground" Value="#999999" />

src/GitHub.UI/Assets/Controls/FilterTextBox.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
1515
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
1616
<Setter Property="Padding" Value="3,3,18,3" />
17-
<Setter Property="ContextMenu" Value="{DynamicResource DefaultContextMenu}" />
1817
<Setter Property="Template">
1918
<Setter.Value>
2019
<ControlTemplate TargetType="{x:Type ui:FilterTextBox}">

src/GitHub.UI/Assets/TextBlocks.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<Setter Property="BorderThickness" Value="1" />
1616
<Setter Property="ToolTipService.ShowDuration" Value="30000" />
1717
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
18-
<Setter Property="ContextMenu" Value="{DynamicResource DefaultContextMenu}" />
1918
<Setter Property="Template">
2019
<Setter.Value>
2120
<ControlTemplate TargetType="{x:Type TextBox}">

src/GitHub.VisualStudio/Views/Dialog/GistCreationView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<ghfvs:PromptTextBox x:Name="fileNameTextBox" Grid.Column="1" Grid.Row="0" AutomationProperties.AutomationId="{x:Static ghfvs:AutomationIDs.GistFileNameTextBox}" />
7575

7676
<Label Grid.Column="0" Grid.Row="1" Target="{Binding ElementName=descriptionTextBox}" Content="{x:Static prop:Resources.Description}"/>
77-
<ghfvs:PromptTextBox x:Name="descriptionTextBox" Grid.Column="1" Grid.Row="1" AutomationProperties.AutomationId="{x:Static ghfvs:AutomationIDs.GistDescriptionTextBlock}"/>
77+
<ghfvs:PromptTextBox x:Name="descriptionTextBox" Grid.Column="1" Grid.Row="1" SpellCheck.IsEnabled="True" AutomationProperties.AutomationId="{x:Static ghfvs:AutomationIDs.GistDescriptionTextBlock}"/>
7878

7979
<StackPanel x:Name="accountStackPanel" Grid.Column="1" Grid.Row="2" Orientation="Horizontal">
8080
<Image

src/GitHub.VisualStudio/Views/Dialog/RepositoryCreationView.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
Grid.Column="1"
112112
MaxLength="{x:Static ghfvs:Constants.MaxRepositoryNameLength}"
113113
Text="{Binding RepositoryName, UpdateSourceTrigger=PropertyChanged}"
114+
SpellCheck.IsEnabled="True"
114115
AutomationProperties.AutomationId="{x:Static ghfvs:AutomationIDs.RepositoryNameTextBox}" />
115116

116117
<StackPanel Grid.Row="1" Grid.Column="1">
@@ -132,6 +133,7 @@
132133
Grid.Row="2"
133134
Grid.Column="1"
134135
Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}"
136+
SpellCheck.IsEnabled="True"
135137
AutomationProperties.AutomationId="{x:Static ghfvs:AutomationIDs.RepositoryDescriptionTextBox}" />
136138

137139
<Label Grid.Row="3"

src/GitHub.VisualStudio/Views/GitHubPane/PullRequestCreationView.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@
146146
Margin="10,5"
147147
Text="{Binding PRTitle, UpdateSourceTrigger=PropertyChanged}"
148148
PromptText="{x:Static prop:Resources.TitleRequired}"
149-
Style="{DynamicResource GitHubVsPromptTextBox}"
149+
Style="{DynamicResource GitHubVsPromptTextBox}"
150+
SpellCheck.IsEnabled="True"
150151
AutomationProperties.AutomationId="{x:Static ghfvs:AutomationIDs.PullRequestCreationTitleTextBox}"/>
151152

152153
<ghfvs:PromptTextBox Grid.Row="2"
@@ -158,6 +159,7 @@
158159
Style="{DynamicResource GitHubVsPromptTextBox}"
159160
VerticalScrollBarVisibility="Auto"
160161
TextWrapping="Wrap"
162+
SpellCheck.IsEnabled="True"
161163
AutomationProperties.AutomationId="{x:Static ghfvs:AutomationIDs.PullRequestCreationDescriptionTextBox}"/>
162164

163165
<ghfvs:ValidationMessage x:Name="titleValidationMessage"

0 commit comments

Comments
 (0)