Skip to content
This repository was archived by the owner on Sep 20, 2022. It is now read-only.

Commit 4d1e452

Browse files
author
Jake Ginnivan
committed
Fixed issue with shout outs
1 parent b6b1970 commit 4d1e452

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

NextVersion.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.0
1+
0.3.0

src/GitReleaseNotes.Tests/IssueTrackers/GitHub/GitHubIssueTrackerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void CreatesReleaseNotesForClosedGitHubIssues()
5757
{
5858
Login = "User",
5959
Name = "Foo",
60-
Url = "http://github.com/foo"
60+
HtmlUrl = "http://github.com/foo"
6161
}
6262
}
6363
}.AsReadOnly()));

src/GitReleaseNotes/IssueTrackers/GitHub/GitHubIssueTracker.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,29 @@ public IEnumerable<OnlineIssue> GetClosedIssues(DateTimeOffset? since)
119119
string repository;
120120
GetRepository(_arguments, out organisation, out repository);
121121

122-
var forRepository = _gitHubClientFactory().Issue.GetForRepository(organisation, repository, new RepositoryIssueRequest
122+
var gitHubClient = _gitHubClientFactory();
123+
var forRepository = gitHubClient.Issue.GetForRepository(organisation, repository, new RepositoryIssueRequest
123124
{
124125
Filter = IssueFilter.All,
125126
Since = since,
126127
State = ItemState.Closed
127128
});
128129
var readOnlyList = forRepository.Result;
129130

131+
var userCache = new Dictionary<string, User>();
132+
Func<User, string> getUserName = u =>
133+
{
134+
var login = u.Login;
135+
if (!userCache.ContainsKey(login))
136+
{
137+
userCache.Add(login, string.IsNullOrEmpty(u.Name) ? gitHubClient.User.Get(login).Result : u);
138+
}
139+
140+
var user = userCache[login];
141+
if (user != null)
142+
return user.Name;
143+
return null;
144+
};
130145
return readOnlyList.Select(i => new OnlineIssue
131146
{
132147
HtmlUrl = i.HtmlUrl,
@@ -135,7 +150,7 @@ public IEnumerable<OnlineIssue> GetClosedIssues(DateTimeOffset? since)
135150
Labels = i.Labels.Select(l => l.Name).ToArray(),
136151
Title = i.Title,
137152
DateClosed = i.ClosedAt.Value,
138-
Contributors = i.PullRequest == null ? new Contributor[0] : new[] { new Contributor(i.User.Name, i.User.Login, i.User.Url) }
153+
Contributors = i.PullRequest == null ? new Contributor[0] : new[] { new Contributor(getUserName(i.User), i.User.Login, i.User.HtmlUrl) }
139154
});
140155
}
141156
}

0 commit comments

Comments
 (0)