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

Commit 7884364

Browse files
authored
Merge pull request #2482 from github/fixes/2481-PullRequest.timelineItems
Use PullRequest.timelineItems instead of PullRequest.timeline
2 parents ab1e2b1 + d66aac3 commit 7884364

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

src/GitHub.InlineReviews/Services/PullRequestSessionService.cs

+23-20
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ public virtual Task<PullRequestDetailModel> ReadPullRequestDetail(HostAddress ad
306306
async Task<PullRequestDetailModel> ReadPullRequestDetailWithResolved(HostAddress address, string owner,
307307
string name, int number, bool refresh)
308308
{
309+
var itemTypes = new[] { PullRequestTimelineItemsItemType.IssueComment, PullRequestTimelineItemsItemType.PullRequestCommit };
309310

310311
if (readPullRequestWithResolved == null)
311312
{
@@ -384,22 +385,22 @@ async Task<PullRequestDetailModel> ReadPullRequestDetailWithResolved(HostAddress
384385
AvatarUrl = review.Author.AvatarUrl(null)
385386
}
386387
}).ToList(),
387-
Timeline = pr.Timeline(null, null, null, null, null).AllPages().Select(item => item.Switch<object>(when =>
388-
when.Commit(commit => new CommitModel
388+
Timeline = pr.TimelineItems(null, null, null, null, itemTypes, null, null).AllPages().Select(item => item.Switch<object>(when =>
389+
when.PullRequestCommit(commit => new CommitModel
389390
{
390-
AbbreviatedOid = commit.AbbreviatedOid,
391+
AbbreviatedOid = commit.Commit.AbbreviatedOid,
391392
Author = new CommitActorModel
392393
{
393-
Name = commit.Author.Name,
394-
Email = commit.Author.Email,
395-
User = commit.Author.User != null ? new ActorModel
394+
Name = commit.Commit.Author.Name,
395+
Email = commit.Commit.Author.Email,
396+
User = commit.Commit.Author.User != null ? new ActorModel
396397
{
397-
Login = commit.Author.User.Login,
398-
AvatarUrl = commit.Author.User.AvatarUrl(null),
398+
Login = commit.Commit.Author.User.Login,
399+
AvatarUrl = commit.Commit.Author.User.AvatarUrl(null),
399400
} : null
400401
},
401-
MessageHeadline = commit.MessageHeadline,
402-
Oid = commit.Oid,
402+
MessageHeadline = commit.Commit.MessageHeadline,
403+
Oid = commit.Commit.Oid,
403404
}).IssueComment(comment => new CommentModel
404405
{
405406
Author = new ActorModel
@@ -491,6 +492,8 @@ async Task<PullRequestDetailModel> ReadPullRequestDetailWithResolved(HostAddress
491492
async Task<PullRequestDetailModel> ReadPullRequestDetailWithoutResolved(HostAddress address, string owner,
492493
string name, int number, bool refresh)
493494
{
495+
var itemTypes = new[] { PullRequestTimelineItemsItemType.IssueComment, PullRequestTimelineItemsItemType.PullRequestCommit };
496+
494497
if (readPullRequestWithoutResolved == null)
495498
{
496499
readPullRequestWithoutResolved = new Query()
@@ -563,21 +566,21 @@ async Task<PullRequestDetailModel> ReadPullRequestDetailWithoutResolved(HostAddr
563566
Url = comment.Url,
564567
}).ToList(),
565568
}).ToList(),
566-
Timeline = pr.Timeline(null, null, null, null, null).AllPages().Select(item => item.Switch<object>(when =>
567-
when.Commit(commit => new CommitModel
569+
Timeline = pr.TimelineItems(null, null, null, null, itemTypes, null, null).AllPages().Select(item => item.Switch<object>(when =>
570+
when.PullRequestCommit(commit => new CommitModel
568571
{
569-
AbbreviatedOid = commit.AbbreviatedOid,
572+
AbbreviatedOid = commit.Commit.AbbreviatedOid,
570573
Author = new CommitActorModel {
571-
Name = commit.Author.Name,
572-
Email = commit.Author.Email,
573-
User = commit.Author.User != null ? new ActorModel
574+
Name = commit.Commit.Author.Name,
575+
Email = commit.Commit.Author.Email,
576+
User = commit.Commit.Author.User != null ? new ActorModel
574577
{
575-
Login = commit.Author.User.Login,
576-
AvatarUrl = commit.Author.User.AvatarUrl(null),
578+
Login = commit.Commit.Author.User.Login,
579+
AvatarUrl = commit.Commit.Author.User.AvatarUrl(null),
577580
} : null
578581
},
579-
MessageHeadline = commit.MessageHeadline,
580-
Oid = commit.Oid,
582+
MessageHeadline = commit.Commit.MessageHeadline,
583+
Oid = commit.Commit.Oid,
581584
}).IssueComment(comment => new CommentModel
582585
{
583586
Author = new ActorModel

0 commit comments

Comments
 (0)