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

Commit 0db9174

Browse files
authored
Merge branch 'master' into fixes/remove-experimental-PR-file-margin
2 parents aef87ca + 4479000 commit 0db9174

File tree

8 files changed

+75
-59
lines changed

8 files changed

+75
-59
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,18 @@ jobs:
6060
path: ${{ env.vsixContainer }}
6161

6262
# We need to run '**\bin\**\*Tests.dll'
63-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\GitHub.App.UnitTests\bin\${{ env.config }}\net46\GitHub.App.UnitTests.dll
64-
continue-on-error: true
65-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\GitHub.Exports.Reactive.UnitTests\bin\${{ env.config }}\net46\GitHub.Exports.Reactive.UnitTests.dll
66-
continue-on-error: true
67-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\GitHub.Exports.UnitTests\bin\${{ env.config }}\net46\GitHub.Exports.UnitTests.dll
68-
continue-on-error: true
69-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\GitHub.Extensions.UnitTests\bin\${{ env.config }}\net46\GitHub.Extensions.UnitTests.dll
70-
continue-on-error: true
71-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\GitHub.InlineReviews.UnitTests\bin\${{ env.config }}\net46\GitHub.InlineReviews.UnitTests.dll
72-
continue-on-error: true
73-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\GitHub.Services.Vssdk.UnitTests\bin\${{ env.config }}\net461\GitHub.Services.Vssdk.UnitTests.dll
74-
continue-on-error: true
75-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\GitHub.StartPage.UnitTests\bin\${{ env.config }}\net46\GitHub.StartPage.UnitTests.dll
76-
continue-on-error: true
77-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\GitHub.TeamFoundation.UnitTests\bin\${{ env.config }}\net46\GitHub.TeamFoundation.UnitTests.dll
78-
continue-on-error: true
79-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\GitHub.UI.UnitTests\bin\${{ env.config }}\net46\GitHub.UI.UnitTests.dll
80-
continue-on-error: true
81-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\GitHub.VisualStudio.UnitTests\bin\${{ env.config }}\net46\GitHub.VisualStudio.UnitTests.dll
82-
continue-on-error: true
83-
- run: vstest.console /TestAdapterPath:test /Settings:test\test.runsettings test\MetricsTests\MetricsTests\bin\${{ env.config }}\MetricsTests.dll
84-
continue-on-error: true
63+
- name: Run unit tests
64+
shell: bash
65+
run: |
66+
vstest.console /TestAdapterPath:test /Settings:test/test.runsettings \
67+
test/GitHub.App.UnitTests/bin/${{ env.config }}/net46/GitHub.App.UnitTests.dll \
68+
test/GitHub.Exports.Reactive.UnitTests/bin/${{ env.config }}/net46/GitHub.Exports.Reactive.UnitTests.dll \
69+
test/GitHub.Exports.UnitTests/bin/${{ env.config }}/net46/GitHub.Exports.UnitTests.dll \
70+
test/GitHub.Extensions.UnitTests/bin/${{ env.config }}/net46/GitHub.Extensions.UnitTests.dll \
71+
test/GitHub.InlineReviews.UnitTests/bin/${{ env.config }}/net46/GitHub.InlineReviews.UnitTests.dll \
72+
test/GitHub.Services.Vssdk.UnitTests/bin/${{ env.config }}/net461/GitHub.Services.Vssdk.UnitTests.dll \
73+
test/GitHub.StartPage.UnitTests/bin/${{ env.config }}/net46/GitHub.StartPage.UnitTests.dll \
74+
test/GitHub.TeamFoundation.UnitTests/bin/${{ env.config }}/net46/GitHub.TeamFoundation.UnitTests.dll \
75+
test/GitHub.UI.UnitTests/bin/${{ env.config }}/net46/GitHub.UI.UnitTests.dll \
76+
test/GitHub.VisualStudio.UnitTests/bin/${{ env.config }}/net46/GitHub.VisualStudio.UnitTests.dll \
77+
test/MetricsTests/MetricsTests/bin/${{ env.config }}/MetricsTests.dll

src/GitHub.App/ViewModels/Dialog/LoginCredentialsViewModel.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using System;
22
using System.ComponentModel.Composition;
33
using System.Reactive.Linq;
4-
using GitHub.App;
5-
using GitHub.Primitives;
64
using GitHub.Services;
75
using ReactiveUI;
86

@@ -28,8 +26,7 @@ public LoginCredentialsViewModel(
2826
(x, y) => x.Value || y.Value
2927
).ToProperty(this, vm => vm.IsLoginInProgress);
3028

31-
UpdateLoginMode();
32-
connectionManager.Connections.CollectionChanged += (_, __) => UpdateLoginMode();
29+
LoginMode = LoginMode.DotComOrEnterprise;
3330

3431
Done = Observable.Merge(
3532
loginToGitHubViewModel.Login,
@@ -55,21 +52,5 @@ public LoginMode LoginMode
5552
public bool IsLoginInProgress { get { return isLoginInProgress.Value; } }
5653

5754
public IObservable<object> Done { get; }
58-
59-
void UpdateLoginMode()
60-
{
61-
var result = LoginMode.DotComOrEnterprise;
62-
63-
foreach (var connection in ConnectionManager.Connections)
64-
{
65-
if (connection.IsLoggedIn)
66-
{
67-
result &= ~((connection.HostAddress == HostAddress.GitHubDotComHostAddress) ?
68-
LoginMode.DotComOnly : LoginMode.EnterpriseOnly);
69-
}
70-
}
71-
72-
LoginMode = result;
73-
}
7455
}
7556
}

src/GitHub.App/ViewModels/GitHubPane/GitHubPaneViewModel.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ public GitHubPaneViewModel(
160160
},
161161
currentPage.Select(x => x is IOpenInBrowser));
162162

163+
BrowseRepository = ReactiveCommand.Create(
164+
() =>
165+
{
166+
var url = LocalRepository.CloneUrl.ToRepositoryUrl();
167+
if (url != null) browser.OpenUrl(url);
168+
},
169+
currentPage.Select(x => x is IOpenInBrowser));
170+
163171
help = ReactiveCommand.Create(() => { });
164172
help.Subscribe(_ =>
165173
{
@@ -531,5 +539,7 @@ static Regex CreateRoute(string route)
531539
var routeFormat = "^" + new Regex("(:([a-z]+))\\b").Replace(route, @"(?<$2>[\w_.\-=]+)") + "$";
532540
return new Regex(routeFormat, RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
533541
}
542+
543+
public ReactiveCommand<Unit, Unit> BrowseRepository { get; }
534544
}
535545
}

src/GitHub.InlineReviews/Services/PullRequestStatusBarManager.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async Task RefreshCurrentSession(LocalRepositoryModel repository, IPullRequestSe
9898
return;
9999
}
100100

101-
var viewModel = CreatePullRequestStatusViewModel(session);
101+
var viewModel = CreatePullRequestStatusViewModel(repository, session);
102102
ShowStatus(viewModel);
103103
}
104104

@@ -155,13 +155,15 @@ async Task<bool> IsDotComOrEnterpriseRepository(LocalRepositoryModel repository)
155155
return false;
156156
}
157157

158-
PullRequestStatusViewModel CreatePullRequestStatusViewModel(IPullRequestSession session)
158+
PullRequestStatusViewModel CreatePullRequestStatusViewModel(LocalRepositoryModel repository, IPullRequestSession session)
159159
{
160-
var pullRequestStatusViewModel = new PullRequestStatusViewModel(openPullRequestsCommand, showCurrentPullRequestCommand);
161-
var pullRequest = session?.PullRequest;
162-
pullRequestStatusViewModel.Number = pullRequest?.Number;
163-
pullRequestStatusViewModel.Title = pullRequest?.Title;
164-
return pullRequestStatusViewModel;
160+
return new PullRequestStatusViewModel(openPullRequestsCommand, showCurrentPullRequestCommand)
161+
{
162+
Number = session?.PullRequest?.Number,
163+
Title = session?.PullRequest?.Title,
164+
RepositoryName = repository?.Name,
165+
RepositoryOwner = repository?.Owner,
166+
};
165167
}
166168

167169
PullRequestStatusView ShowStatus(PullRequestStatusViewModel pullRequestStatusViewModel = null)

src/GitHub.InlineReviews/ViewModels/PullRequestStatusViewModel.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public class PullRequestStatusViewModel : INotifyPropertyChanged
88
{
99
int? number;
1010
string title;
11+
string repositoryName;
12+
string repositoryOwner;
1113

1214
public PullRequestStatusViewModel(ICommand openPullRequestsCommand, ICommand showCurrentPullRequestCommand)
1315
{
@@ -41,6 +43,32 @@ public string Title
4143
}
4244
}
4345

46+
public string RepositoryOwner
47+
{
48+
get { return repositoryOwner; }
49+
set
50+
{
51+
if (repositoryOwner != value)
52+
{
53+
repositoryOwner = value;
54+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RepositoryOwner)));
55+
}
56+
}
57+
}
58+
59+
public string RepositoryName
60+
{
61+
get { return repositoryName; }
62+
set
63+
{
64+
if (repositoryName != value)
65+
{
66+
repositoryName = value;
67+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RepositoryName)));
68+
}
69+
}
70+
}
71+
4472
public ICommand OpenPullRequestsCommand { get; }
4573
public ICommand ShowCurrentPullRequestCommand { get; }
4674

src/GitHub.InlineReviews/Views/PullRequestStatusView.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@
4949
Fill="White"
5050
VerticalAlignment="Bottom"
5151
Margin="0 0 4 0 "
52-
Icon="git_pull_request" />
52+
Icon="mark_github" />
53+
<TextBlock VerticalAlignment="Center">
54+
<Run Text="{Binding RepositoryOwner}" /> / <Run Text="{Binding RepositoryName}" />
55+
</TextBlock>
5356
</StackPanel>
5457
</Button>
5558
<Grid.ToolTip>

src/GitHub.VisualStudio.UI/Views/GitHubPane/GitHubPaneView.xaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,8 @@
5757
<Separator Margin="5,-2,5,0"
5858
Foreground="{DynamicResource GitHubPaneTitleBrush}"
5959
Style="{StaticResource TitleVerticalSeparator}" />
60-
<TextBlock Margin="0,-5,0,0"
61-
VerticalAlignment="Center"
62-
Foreground="{DynamicResource GitHubVsGrayText}"
63-
Text="{Binding LocalRepository.Name}" />
64-
</StackPanel>
60+
<ghfvs:GitHubActionLink Margin="0,-2.5,0,0" Command="{Binding BrowseRepository}" Content="{Binding LocalRepository.Name}" />
61+
</StackPanel>
6562

6663
<Separator Margin="0,0,0,2"
6764
DockPanel.Dock="Top"

test/GitHub.App.UnitTests/ViewModels/Dialog/LoginCredentialsViewModelTests.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ public async Task AllowsLoginFromEnterpriseAfterGitHubLoginHasFailedAsync()
7676
public class TheLoginModeProperty : TestBaseClass
7777
{
7878
[Test]
79-
public void LoginModeTracksAvailableConnections()
79+
public void LoginModeIgnoresAvailableConnections()
8080
{
81+
// We always want to option to log-in to GitHub or GitHub Enterprise
82+
8183
var connectionManager = Substitute.For<IConnectionManager>();
8284
var connections = new ObservableCollectionEx<IConnection>();
8385
var gitHubLogin = Substitute.For<ILoginToGitHubViewModel>();
@@ -96,13 +98,13 @@ public void LoginModeTracksAvailableConnections()
9698
Assert.That(LoginMode.DotComOrEnterprise, Is.EqualTo(loginViewModel.LoginMode));
9799

98100
connections.Add(enterpriseConnection);
99-
Assert.That(LoginMode.DotComOnly, Is.EqualTo(loginViewModel.LoginMode));
101+
Assert.That(LoginMode.DotComOrEnterprise, Is.EqualTo(loginViewModel.LoginMode));
100102

101103
connections.Add(gitHubConnection);
102-
Assert.That(LoginMode.None, Is.EqualTo(loginViewModel.LoginMode));
104+
Assert.That(LoginMode.DotComOrEnterprise, Is.EqualTo(loginViewModel.LoginMode));
103105

104106
connections.RemoveAt(0);
105-
Assert.That(LoginMode.EnterpriseOnly, Is.EqualTo(loginViewModel.LoginMode));
107+
Assert.That(LoginMode.DotComOrEnterprise, Is.EqualTo(loginViewModel.LoginMode));
106108
}
107109
}
108110

0 commit comments

Comments
 (0)