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

Commit f9f8d9a

Browse files
Formatting code
1 parent d5d633e commit f9f8d9a

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

src/GitHub.InlineReviews/Services/PullRequestSessionService.cs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -358,42 +358,6 @@ public virtual async Task<PullRequestDetailModel> ReadPullRequestDetail(HostAddr
358358
return result;
359359
}
360360

361-
private async Task<LastCommitAdapter> GetPullRequestLastCommitAdapter(HostAddress address, string owner, string name, int number)
362-
{
363-
if(readCommitStatuses == null)
364-
{
365-
readCommitStatuses = new Query()
366-
.Repository(Var(nameof(owner)), Var(nameof(name)))
367-
.PullRequest(Var(nameof(number))).Commits(last: 1).Nodes.Select(
368-
commit => new LastCommitAdapter
369-
{
370-
Statuses = commit.Commit.Status
371-
.Select(context =>
372-
context.Contexts.Select(statusContext => new StatusModel
373-
{
374-
State = (StatusState)statusContext.State,
375-
Context = statusContext.Context,
376-
TargetUrl = statusContext.TargetUrl,
377-
Description = statusContext.Description,
378-
AvatarUrl = statusContext.Creator.AvatarUrl(null)
379-
}).ToList()
380-
).SingleOrDefault()
381-
}
382-
).Compile();
383-
}
384-
385-
var vars = new Dictionary<string, object>
386-
{
387-
{ nameof(owner), owner },
388-
{ nameof(name), name },
389-
{ nameof(number), number },
390-
};
391-
392-
var connection = await graphqlFactory.CreateConnection(address);
393-
var result = await connection.Run(readCommitStatuses, vars);
394-
return result.First();
395-
}
396-
397361
public virtual async Task<ActorModel> ReadViewer(HostAddress address)
398362
{
399363
if (readViewer == null)
@@ -777,6 +741,42 @@ Task<IRepository> GetRepository(ILocalRepositoryModel repository)
777741
return Task.Factory.StartNew(() => gitService.GetRepository(repository.LocalPath));
778742
}
779743

744+
async Task<LastCommitAdapter> GetPullRequestLastCommitAdapter(HostAddress address, string owner, string name, int number)
745+
{
746+
if (readCommitStatuses == null)
747+
{
748+
readCommitStatuses = new Query()
749+
.Repository(Var(nameof(owner)), Var(nameof(name)))
750+
.PullRequest(Var(nameof(number))).Commits(last: 1).Nodes.Select(
751+
commit => new LastCommitAdapter
752+
{
753+
Statuses = commit.Commit.Status
754+
.Select(context =>
755+
context.Contexts.Select(statusContext => new StatusModel
756+
{
757+
State = (StatusState)statusContext.State,
758+
Context = statusContext.Context,
759+
TargetUrl = statusContext.TargetUrl,
760+
Description = statusContext.Description,
761+
AvatarUrl = statusContext.Creator.AvatarUrl(null)
762+
}).ToList()
763+
).SingleOrDefault()
764+
}
765+
).Compile();
766+
}
767+
768+
var vars = new Dictionary<string, object>
769+
{
770+
{ nameof(owner), owner },
771+
{ nameof(name), name },
772+
{ nameof(number), number },
773+
};
774+
775+
var connection = await graphqlFactory.CreateConnection(address);
776+
var result = await connection.Run(readCommitStatuses, vars);
777+
return result.First();
778+
}
779+
780780
static void BuildPullRequestThreads(PullRequestDetailModel model)
781781
{
782782
var commentsByReplyId = new Dictionary<string, List<CommentAdapter>>();

0 commit comments

Comments
 (0)