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

Commit 6141d31

Browse files
committed
Removed LogoutRequired flow for Gists.
This was only required when upgrading from very old versions of GHfVS, and was recently broken, causing the "Logout Required" view to be shown to the user every time they tried to create a gist. Fixes #1201
1 parent 19bf7aa commit 6141d31

File tree

17 files changed

+4
-381
lines changed

17 files changed

+4
-381
lines changed

src/GitHub.App/Controllers/UIController.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ void ConfigureUIHandlingStates()
319319
ConfigureEntriesExitsForView(UIViewType.Login);
320320
ConfigureEntriesExitsForView(UIViewType.TwoFactor);
321321
ConfigureEntriesExitsForView(UIViewType.Gist);
322-
ConfigureEntriesExitsForView(UIViewType.LogoutRequired);
323322
ConfigureEntriesExitsForView(UIViewType.StartPageClone);
324323

325324
uiStateMachine.Configure(UIViewType.End)
@@ -421,7 +420,6 @@ void ConfigureLogicStates()
421420
ConfigureSingleViewLogic(UIControllerFlow.Create, UIViewType.Create);
422421
ConfigureSingleViewLogic(UIControllerFlow.Gist, UIViewType.Gist);
423422
ConfigureSingleViewLogic(UIControllerFlow.Home, UIViewType.PRList);
424-
ConfigureSingleViewLogic(UIControllerFlow.LogoutRequired, UIViewType.LogoutRequired);
425423
ConfigureSingleViewLogic(UIControllerFlow.Publish, UIViewType.Publish);
426424
ConfigureSingleViewLogic(UIControllerFlow.PullRequestList, UIViewType.PRList);
427425
ConfigureSingleViewLogic(UIControllerFlow.PullRequestDetail, UIViewType.PRDetail);
@@ -448,11 +446,7 @@ UIControllerFlow SelectActiveFlow()
448446
{
449447
var host = connection != null ? hosts.LookupHost(connection.HostAddress) : null;
450448
var loggedIn = host?.IsLoggedIn ?? false;
451-
if (!loggedIn || selectedFlow != UIControllerFlow.Gist)
452-
return loggedIn ? selectedFlow : UIControllerFlow.Authentication;
453-
454-
var supportsGist = host?.SupportsGist ?? false;
455-
return supportsGist ? selectedFlow : UIControllerFlow.LogoutRequired;
449+
return loggedIn ? selectedFlow : UIControllerFlow.Authentication;
456450
}
457451

458452
/// <summary>

src/GitHub.App/GitHub.App.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@
216216
<Compile Include="ViewModels\NotAGitRepositoryViewModel.cs" />
217217
<Compile Include="ViewModels\NotAGitHubRepositoryViewModel.cs" />
218218
<Compile Include="ViewModels\LoggedOutViewModel.cs" />
219-
<Compile Include="ViewModels\LogoutRequiredViewModel.cs" />
220219
<Compile Include="ViewModels\PullRequestCreationViewModel.cs" />
221220
<Compile Include="ViewModels\PullRequestDetailViewModel.cs" />
222221
<Compile Include="ViewModels\PullRequestDirectoryNode.cs" />

src/GitHub.App/Models/DisconnectedRepositoryHosts.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public DisconnectedRepositoryHost()
2525

2626
public bool IsLoggedIn { get; private set; }
2727
public bool IsLoggingIn { get; private set; }
28-
public bool SupportsGist { get; private set; }
2928
public ReactiveList<IAccount> Organizations { get; private set; }
3029
public ReactiveList<IAccount> Accounts { get; private set; }
3130
public string Title { get; private set; }

src/GitHub.App/Models/RepositoryHost.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ public bool IsLoggedIn
6565
private set { this.RaiseAndSetIfChanged(ref isLoggedIn, value); }
6666
}
6767

68-
public bool SupportsGist { get; private set; }
69-
7068
public string Title { get; private set; }
7169

7270
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
@@ -157,40 +155,6 @@ static IObservable<AuthenticationResult> GetAuthenticationResultForUser(UserAndS
157155
: AuthenticationResult.Success);
158156
}
159157

160-
IObservable<AuthenticationResult> LoginWithApiUser(UserAndScopes userAndScopes)
161-
{
162-
return GetAuthenticationResultForUser(userAndScopes)
163-
.SelectMany(result =>
164-
{
165-
if (result.IsSuccess())
166-
{
167-
var accountCacheItem = new AccountCacheItem(userAndScopes.User);
168-
usage.IncrementLoginCount().Forget();
169-
return ModelService.InsertUser(accountCacheItem).Select(_ => result);
170-
}
171-
172-
if (result == AuthenticationResult.VerificationFailure)
173-
{
174-
return loginCache.EraseLogin(Address).Select(_ => result);
175-
}
176-
return Observable.Return(result);
177-
})
178-
.ObserveOn(RxApp.MainThreadScheduler)
179-
.Do(result =>
180-
{
181-
if (result.IsSuccess())
182-
{
183-
SupportsGist = userAndScopes.Scopes?.Contains("gist") ?? true;
184-
IsLoggedIn = true;
185-
}
186-
187-
log.Info("Log in from cache for login '{0}' to host '{1}' {2}",
188-
userAndScopes?.User?.Login ?? "(null)",
189-
hostAddress.ApiUri,
190-
result.IsSuccess() ? "SUCCEEDED" : "FAILED");
191-
});
192-
}
193-
194158
IObservable<UserAndScopes> GetUserFromApi()
195159
{
196160
return Observable.Defer(() => ApiClient.GetUser());

src/GitHub.App/Resources.Designer.cs

Lines changed: 0 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GitHub.App/Resources.resx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,6 @@
159159
<data name="LoginTitle" xml:space="preserve">
160160
<value>Connect To GitHub</value>
161161
</data>
162-
<data name="LogoutRequiredFeatureGist" xml:space="preserve">
163-
<value>create a Gist</value>
164-
</data>
165-
<data name="LogoutRequiredMessage" xml:space="preserve">
166-
<value>To {0} you need to sign out and back in.</value>
167-
</data>
168-
<data name="LogoutRequiredTitle" xml:space="preserve">
169-
<value>Sign Out Required</value>
170-
</data>
171162
<data name="PasswordValidatorEmpty" xml:space="preserve">
172163
<value>Please enter your password</value>
173164
</data>

src/GitHub.App/SampleData/SampleViewModels.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,6 @@ public bool IsLoggedIn
276276
private set;
277277
}
278278

279-
public bool SupportsGist
280-
{
281-
get;
282-
private set;
283-
}
284-
285279
public IModelService ModelService
286280
{
287281
get;

src/GitHub.App/ViewModels/LogoutRequiredViewModel.cs

Lines changed: 0 additions & 108 deletions
This file was deleted.

src/GitHub.Exports.Reactive/GitHub.Exports.Reactive.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
<Compile Include="ViewModels\INotAGitRepositoryViewModel.cs" />
116116
<Compile Include="ViewModels\INotAGitHubRepositoryViewModel.cs" />
117117
<Compile Include="ViewModels\ILoggedOutViewModel.cs" />
118-
<Compile Include="ViewModels\ILogoutRequiredViewModel.cs" />
119118
<Compile Include="ViewModels\ILoginControlViewModel.cs" />
120119
<Compile Include="ViewModels\ILoginToGitHubForEnterpriseViewModel.cs" />
121120
<Compile Include="ViewModels\ILoginToGitHubViewModel.cs" />

src/GitHub.Exports.Reactive/Models/IRepositoryHost.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public interface IRepositoryHost : IDisposable
1313
IApiClient ApiClient { get; }
1414
IModelService ModelService { get; }
1515
bool IsLoggedIn { get; }
16-
bool SupportsGist { get; }
1716
string Title { get; }
1817

1918
IObservable<AuthenticationResult> LogIn(string usernameOrEmail, string password);

0 commit comments

Comments
 (0)