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

Commit 816c4eb

Browse files
authored
Merge pull request #1386 from github/fixes/1385-checked-isloggedin
Check Connection.IsLoggedIn.
2 parents b486f1c + cda98c5 commit 816c4eb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ async Task UpdateContent(ILocalRepositoryModel repository)
370370

371371
Connection = await connectionManager.GetConnection(hostAddress);
372372

373-
if (Connection != null)
373+
if (Connection?.IsLoggedIn == true)
374374
{
375375
navigator.Clear();
376376
Content = navigator;

test/UnitTests/GitHub.App/ViewModels/GitHubPane/GitHubPaneViewModelTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ public async Task LoggedOutShownWhenNotLoggedInToEnterprise()
9494
public async Task NavigatorShownWhenRepositoryIsAGitHubRepo()
9595
{
9696
var te = CreateTeamExplorerServiceHolder(ValidGitHubRepo);
97-
var target = CreateTarget(teServiceHolder: te);
97+
var cm = CreateConnectionManager("https://github.com");
98+
var target = CreateTarget(teServiceHolder: te, connectionManager: cm);
9899

99100
await Initialize(target);
100101

@@ -105,7 +106,8 @@ public async Task NavigatorShownWhenRepositoryIsAGitHubRepo()
105106
public async Task NavigatorShownWhenRepositoryIsAnEnterpriseRepo()
106107
{
107108
var te = CreateTeamExplorerServiceHolder(ValidEnterpriseRepo);
108-
var target = CreateTarget(teServiceHolder: te);
109+
var cm = CreateConnectionManager("https://enterprise.com");
110+
var target = CreateTarget(teServiceHolder: te, connectionManager: cm);
109111

110112
await Initialize(target);
111113

@@ -249,6 +251,7 @@ static void AddConnection(IConnectionManager connectionManager, string address)
249251
var hostAddress = HostAddress.Create(address);
250252
var connections = (ObservableCollectionEx<IConnection>)connectionManager.Connections;
251253
connection.HostAddress.Returns(hostAddress);
254+
connection.IsLoggedIn.Returns(true);
252255
connectionManager.GetConnection(hostAddress).Returns(connection);
253256
connections.Add(connection);
254257
}

0 commit comments

Comments
 (0)