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

Commit 31f2cf1

Browse files
authored
Merge branch 'master' into fixes/tool-window-discoverability
2 parents 68cb3a0 + 2ff1ca4 commit 31f2cf1

File tree

3 files changed

+19
-36
lines changed

3 files changed

+19
-36
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ jobs:
6363
- name: Run unit tests
6464
shell: bash
6565
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
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
}

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)