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

Commit

Permalink
Merge pull request #2482 from github/fixes/2481-PullRequest.timelineI…
Browse files Browse the repository at this point in the history
…tems

Use PullRequest.timelineItems instead of PullRequest.timeline
  • Loading branch information
jcansdale committed Mar 19, 2020
2 parents ab1e2b1 + d66aac3 commit 7884364
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions src/GitHub.InlineReviews/Services/PullRequestSessionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ public virtual Task<PullRequestDetailModel> ReadPullRequestDetail(HostAddress ad
async Task<PullRequestDetailModel> ReadPullRequestDetailWithResolved(HostAddress address, string owner,
string name, int number, bool refresh)
{
var itemTypes = new[] { PullRequestTimelineItemsItemType.IssueComment, PullRequestTimelineItemsItemType.PullRequestCommit };

if (readPullRequestWithResolved == null)
{
Expand Down Expand Up @@ -384,22 +385,22 @@ async Task<PullRequestDetailModel> ReadPullRequestDetailWithResolved(HostAddress
AvatarUrl = review.Author.AvatarUrl(null)
}
}).ToList(),
Timeline = pr.Timeline(null, null, null, null, null).AllPages().Select(item => item.Switch<object>(when =>
when.Commit(commit => new CommitModel
Timeline = pr.TimelineItems(null, null, null, null, itemTypes, null, null).AllPages().Select(item => item.Switch<object>(when =>
when.PullRequestCommit(commit => new CommitModel
{
AbbreviatedOid = commit.AbbreviatedOid,
AbbreviatedOid = commit.Commit.AbbreviatedOid,
Author = new CommitActorModel
{
Name = commit.Author.Name,
Email = commit.Author.Email,
User = commit.Author.User != null ? new ActorModel
Name = commit.Commit.Author.Name,
Email = commit.Commit.Author.Email,
User = commit.Commit.Author.User != null ? new ActorModel
{
Login = commit.Author.User.Login,
AvatarUrl = commit.Author.User.AvatarUrl(null),
Login = commit.Commit.Author.User.Login,
AvatarUrl = commit.Commit.Author.User.AvatarUrl(null),
} : null
},
MessageHeadline = commit.MessageHeadline,
Oid = commit.Oid,
MessageHeadline = commit.Commit.MessageHeadline,
Oid = commit.Commit.Oid,
}).IssueComment(comment => new CommentModel
{
Author = new ActorModel
Expand Down Expand Up @@ -491,6 +492,8 @@ async Task<PullRequestDetailModel> ReadPullRequestDetailWithResolved(HostAddress
async Task<PullRequestDetailModel> ReadPullRequestDetailWithoutResolved(HostAddress address, string owner,
string name, int number, bool refresh)
{
var itemTypes = new[] { PullRequestTimelineItemsItemType.IssueComment, PullRequestTimelineItemsItemType.PullRequestCommit };

if (readPullRequestWithoutResolved == null)
{
readPullRequestWithoutResolved = new Query()
Expand Down Expand Up @@ -563,21 +566,21 @@ async Task<PullRequestDetailModel> ReadPullRequestDetailWithoutResolved(HostAddr
Url = comment.Url,
}).ToList(),
}).ToList(),
Timeline = pr.Timeline(null, null, null, null, null).AllPages().Select(item => item.Switch<object>(when =>
when.Commit(commit => new CommitModel
Timeline = pr.TimelineItems(null, null, null, null, itemTypes, null, null).AllPages().Select(item => item.Switch<object>(when =>
when.PullRequestCommit(commit => new CommitModel
{
AbbreviatedOid = commit.AbbreviatedOid,
AbbreviatedOid = commit.Commit.AbbreviatedOid,
Author = new CommitActorModel {
Name = commit.Author.Name,
Email = commit.Author.Email,
User = commit.Author.User != null ? new ActorModel
Name = commit.Commit.Author.Name,
Email = commit.Commit.Author.Email,
User = commit.Commit.Author.User != null ? new ActorModel
{
Login = commit.Author.User.Login,
AvatarUrl = commit.Author.User.AvatarUrl(null),
Login = commit.Commit.Author.User.Login,
AvatarUrl = commit.Commit.Author.User.AvatarUrl(null),
} : null
},
MessageHeadline = commit.MessageHeadline,
Oid = commit.Oid,
MessageHeadline = commit.Commit.MessageHeadline,
Oid = commit.Commit.Oid,
}).IssueComment(comment => new CommentModel
{
Author = new ActorModel
Expand Down

0 comments on commit 7884364

Please sign in to comment.