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

Commit e9b547a

Browse files
authored
Merge branch 'master' into fixes/1666-filter-pr-solution-explorer
2 parents 0b1a752 + dc745e5 commit e9b547a

36 files changed

+456
-303
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '2.5.1.{build}'
1+
version: '2.5.2.{build}'
22
skip_tags: true
33
install:
44
- ps: |

src/GitHub.App/Models/Account.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Account(Octokit.Account account, IObservable<BitmapSource> bitmapSource)
8080

8181
public long PrivateReposInPlan { get; private set; }
8282

83-
public string AvatarUrl { get; private set; }
83+
public string AvatarUrl { get; set; }
8484

8585
public BitmapSource Avatar
8686
{

src/GitHub.App/SampleData/ForkRepositoryExecuteViewModelDesigner.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public ForkRepositoryExecuteViewModelDesigner()
3030

3131
public IObservable<object> Done => null;
3232

33+
public IObservable<object> Back => null;
34+
3335
public string Title => null;
3436

3537
public IRepositoryModel SourceRepository { get; set; }
@@ -40,6 +42,8 @@ public ForkRepositoryExecuteViewModelDesigner()
4042

4143
public IReactiveCommand<Repository> CreateFork => null;
4244

45+
public IReactiveCommand<object> BackCommand => null;
46+
4347
public bool ResetMasterTracking { get; set; } = true;
4448

4549
public bool AddUpstream { get; set; } = true;

src/GitHub.App/SampleData/ForkRepositorySelectViewModelDesigner.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public ForkRepositorySelectViewModelDesigner()
1414
{
1515
Accounts = new[]
1616
{
17-
new AccountDesigner { Login = "Myself" },
18-
new AccountDesigner { Login = "MyOrg1" },
19-
new AccountDesigner { Login = "MyOrg2" },
20-
new AccountDesigner { Login = "MyOrg3" },
21-
new AccountDesigner { Login = "a-long-org-name" },
17+
new AccountDesigner { Login = "Myself", AvatarUrl = "https://identicons.github.com/myself.png" },
18+
new AccountDesigner { Login = "MyOrg1", AvatarUrl = "https://identicons.github.com/myorg1.png" },
19+
new AccountDesigner { Login = "MyOrg2", AvatarUrl = "https://identicons.github.com/myorg2.png" },
20+
new AccountDesigner { Login = "MyOrg3", AvatarUrl = "https://identicons.github.com/myorg3.png" },
21+
new AccountDesigner { Login = "a-long-org-name", AvatarUrl = "https://identicons.github.com/a-long-org-name.png" },
2222
};
2323

2424
ExistingForks = new[]

src/GitHub.App/Services/RepositoryForkService.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public IObservable<Repository> ForkRepository(IApiClient apiClient, IRepositoryM
4141
log.Verbose("ForkRepository Source:{SourceOwner}/{SourceName} To:{DestinationOwner}", sourceRepository.Owner, sourceRepository.Name, repositoryFork.Organization ?? "[Current User]");
4242
log.Verbose("ForkRepository updateOrigin:{UpdateOrigin} addUpstream:{AddUpstream} trackMasterUpstream:{TrackMasterUpstream}", updateOrigin, addUpstream, trackMasterUpstream);
4343

44-
RecordForkRepositoryUsage(updateOrigin, addUpstream, trackMasterUpstream).Forget();
44+
usageTracker.IncrementCounter(model => model.NumberOfReposForked).Forget();
4545

4646
return Observable.Defer(() => apiClient.ForkRepository(sourceRepository.Owner, sourceRepository.Name, repositoryFork)
4747
.ObserveOn(RxApp.MainThreadScheduler)
@@ -63,26 +63,6 @@ public IObservable<Repository> ForkRepository(IApiClient apiClient, IRepositoryM
6363
});
6464
}
6565

66-
private async Task RecordForkRepositoryUsage(bool updateOrigin, bool addUpstream, bool trackMasterUpstream)
67-
{
68-
await usageTracker.IncrementCounter(model => model.NumberOfReposForked);
69-
70-
if (updateOrigin)
71-
{
72-
await usageTracker.IncrementCounter(model => model.NumberOfOriginsUpdatedWhenForkingRepo);
73-
}
74-
75-
if (addUpstream)
76-
{
77-
await usageTracker.IncrementCounter(model => model.NumberOfUpstreamsAddedWhenForkingRepo);
78-
}
79-
80-
if (trackMasterUpstream)
81-
{
82-
await usageTracker.IncrementCounter(model => model.NumberOfTrackMasterUpstreamWhenForkingRepo);
83-
}
84-
}
85-
8666
public IObservable<object> SwitchRemotes(IRepositoryModel destinationRepository, bool updateOrigin, bool addUpstream, bool trackMasterUpstream)
8767
{
8868
return Observable.Defer(() => Observable.Return(new object())

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ IRepositoryForkService repositoryForkService
4545
.Subscribe(tuple => CanResetMasterTracking = tuple.Item1 && tuple.Item2);
4646

4747
CreateFork = ReactiveCommand.CreateAsyncObservable(OnCreateFork);
48+
BackCommand = ReactiveCommand.Create();
4849
}
4950

5051
public IRepositoryModel SourceRepository { get; private set; }
@@ -55,10 +56,14 @@ IRepositoryForkService repositoryForkService
5556

5657
public IReactiveCommand<Repository> CreateFork { get; }
5758

59+
public IReactiveCommand<object> BackCommand { get; }
60+
5861
public string Title => Resources.ForkRepositoryTitle;
5962

6063
public IObservable<object> Done => CreateFork.Where(repository => repository != null);
6164

65+
public IObservable<object> Back => BackCommand.AsObservable();
66+
6267
public async Task InitializeAsync(ILocalRepositoryModel sourceRepository, IAccount destinationAccount, IConnection connection)
6368
{
6469
var modelService = await modelServiceFactory.CreateAsync(connection);
@@ -125,21 +130,22 @@ public bool AddUpstream
125130
set { this.RaiseAndSetIfChanged(ref addUpstream, value); }
126131
}
127132

128-
bool canResetMasterTracking = true;
133+
bool canResetMasterTracking;
129134
public bool CanResetMasterTracking
130135
{
131136
get { return canResetMasterTracking; }
132137
private set { this.RaiseAndSetIfChanged(ref canResetMasterTracking, value); }
133138
}
134139

135-
bool resetMasterTracking = true;
140+
bool resetMasterTracking;
136141
public bool ResetMasterTracking
137142
{
138143
get { return resetMasterTracking; }
139144
set { this.RaiseAndSetIfChanged(ref resetMasterTracking, value); }
140145
}
141146

142147
string error = null;
148+
143149
public string Error
144150
{
145151
get { return error; }

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ void BuildAccounts(IReadOnlyList<IAccount> accessibleAccounts, ILocalRepositoryM
108108

109109
Accounts = readOnlyList.Where(arg => arg.Fork == null).Select(arg => arg.Account).ToList();
110110
ExistingForks = readOnlyList.Where(arg => arg.Fork != null).Select(arg => arg.Fork).ToList();
111+
112+
// HACK: Our avatar cache only provides avatars in a very small size, but we want to
113+
// display them 100x100 in the Fork view. For now, wse the AvatarUrl directly to get
114+
// the avatar, appending "s=100" to the URL to get the correct size.
115+
foreach (Account account in Accounts)
116+
{
117+
account.AvatarUrl += "&s=100";
118+
}
111119
}
112120
}
113121
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public ForkRepositoryViewModel(
3333

3434
selectPage.SwitchOrigin.Subscribe(x => ShowSwitchRepositoryPath((IRemoteRepositoryModel)x));
3535
selectPage.Done.Subscribe(x => ShowExecutePage((IAccount)x).Forget());
36+
executePage.Back.Subscribe(x => ShowSelectPage().Forget());
3637
}
3738

3839
public ILocalRepositoryModel Repository { get; private set; }
@@ -47,7 +48,12 @@ public async Task InitializeAsync(ILocalRepositoryModel repository, IConnection
4748
{
4849
Repository = repository;
4950
Connection = connection;
50-
await selectPage.InitializeAsync(repository, connection);
51+
await ShowSelectPage();
52+
}
53+
54+
async Task ShowSelectPage()
55+
{
56+
await selectPage.InitializeAsync(Repository, Connection);
5157
Content = selectPage;
5258
}
5359

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using GitHub.Services;
1313
using ReactiveUI;
1414
using Serilog;
15+
using static System.FormattableString;
1516

1617
namespace GitHub.ViewModels.GitHubPane
1718
{
@@ -71,6 +72,8 @@ public PullRequestReviewAuthoringViewModel(
7172
hasBodyOrComments,
7273
_ => DoSubmit(Octokit.PullRequestReviewEvent.RequestChanges));
7374
Cancel = ReactiveCommand.CreateAsyncTask(DoCancel);
75+
NavigateToPullRequest = ReactiveCommand.Create().OnExecuteCompleted(_ =>
76+
NavigateTo(Invariant($"{LocalRepository.Owner}/{LocalRepository.Name}/pull/{PullRequestModel.Number}")));
7477
}
7578

7679
/// <inheritdoc/>

src/GitHub.Exports.Reactive/ViewModels/Dialog/IForkRepositoryExecuteViewModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public interface IForkRepositoryExecuteViewModel : IDialogContentViewModel
2323
/// </summary>
2424
IReactiveCommand<Repository> CreateFork { get; }
2525

26+
IReactiveCommand<object> BackCommand { get; }
27+
2628
bool ResetMasterTracking { get; set; }
2729

2830
bool AddUpstream { get; set; }
@@ -34,6 +36,7 @@ public interface IForkRepositoryExecuteViewModel : IDialogContentViewModel
3436
bool CanResetMasterTracking { get; }
3537

3638
string Error { get; }
39+
IObservable<object> Back { get; }
3740

3841
/// <summary>
3942
/// Initializes the view model.

0 commit comments

Comments
 (0)