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

Commit e161f11

Browse files
committed
Warn when showing max number of repos in org
1 parent 4d31f65 commit e161f11

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

src/GitHub.App/ViewModels/Dialog/Clone/RepositorySelectViewModel.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.ComponentModel;
44
using System.ComponentModel.Composition;
5+
using System.Globalization;
56
using System.Linq;
67
using System.Reactive.Linq;
78
using System.Threading.Tasks;
@@ -120,7 +121,7 @@ public async Task Activate()
120121
.Select(x => new RepositoryItemViewModel(x, "Collaborator repositories"));
121122
var orgRepositories = results.Organizations
122123
.OrderBy(x => x.Key)
123-
.SelectMany(x => x.Value.Select(y => new RepositoryItemViewModel(y, x.Key)));
124+
.SelectMany(x => x.Value.Select(y => new RepositoryItemViewModel(y, GroupName(x, 100))));
124125
Items = yourRepositories.Concat(collaboratorRepositories).Concat(orgRepositories).ToList();
125126
log.Information("Read {Total} viewer repositories", Items.Count);
126127
ItemsView = CollectionViewSource.GetDefaultView(Items);
@@ -144,6 +145,17 @@ public async Task Activate()
144145
}
145146
}
146147

148+
static string GroupName(KeyValuePair<string, IReadOnlyList<RepositoryListItemModel>> group, int max)
149+
{
150+
var name = group.Key;
151+
if (group.Value.Count == max)
152+
{
153+
name += $" ({string.Format(CultureInfo.InvariantCulture, Resources.MostRecentlyPushed, max)})";
154+
}
155+
156+
return name;
157+
}
158+
147159
bool FilterItem(object obj)
148160
{
149161
if (obj is IRepositoryItemViewModel item && !string.IsNullOrWhiteSpace(Filter))

src/GitHub.Resources/Resources.Designer.cs

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

src/GitHub.Resources/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,4 +845,7 @@ https://git-scm.com/download/win</value>
845845
<data name="CouldntFindCorrespondingFile" xml:space="preserve">
846846
<value>Couldn't find file corresponding to '{0}' in the repository. Please do a 'git fetch' or checkout the target pull request.</value>
847847
</data>
848+
<data name="MostRecentlyPushed" xml:space="preserve">
849+
<value>{0} most recently pushed</value>
850+
</data>
848851
</root>

0 commit comments

Comments
 (0)