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

Functionality to support Check Suites API #1798

Merged
merged 28 commits into from
Aug 21, 2018
Merged

Conversation

StanleyGoldman
Copy link
Contributor

@StanleyGoldman StanleyGoldman commented Jul 24, 2018

This pull request displays a summary line for Check Runs and links a user to the Check Run page.

@StanleyGoldman StanleyGoldman changed the base branch from master to stanley/check-suites-pull-request-model-1 July 24, 2018 18:41
@meaghanlewis meaghanlewis added this to the 2.5.5 milestone Jul 30, 2018
# Conflicts:
#	src/GitHub.App/Services/PullRequestService.cs
#	src/GitHub.App/ViewModels/GitHubPane/PullRequestDetailViewModel.cs
#	src/GitHub.Exports/Models/PullRequestDetailModel.cs
#	src/GitHub.InlineReviews/Services/PullRequestSessionService.cs
#	test/GitHub.App.UnitTests/ViewModels/GitHubPane/PullRequestDetailViewModelTests.cs
@StanleyGoldman StanleyGoldman changed the title [WIP] Functionality to support Check Suites API Functionality to support Check Suites API Aug 10, 2018
@StanleyGoldman StanleyGoldman changed the base branch from stanley/check-suites-pull-request-model-1 to master August 10, 2018 18:38
Copy link
Contributor

@grokys grokys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far! A few nits, and one requested change that I couldn't add as an inline comment:

  • Could the nupkg be removed from the lib directory now? That package is on nuget.org right?

{
item.CommentCount += item.Reviews.Sum(x => x.Count);
item.Reviews = null;

var hasStatuses = item.LastCommit.Statuses != null
var hasCheckSuites = item.LastCommit.CheckSuites != null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could these be written more simply?

var hasCheckSuites = item.LastCommit.CheckSuites?.Any() ?? false;

return pullRequestCheckViewModel;
}) ?? new PullRequestCheckViewModel[0];

return statuses.Union(checks).OrderBy(model => model.Title);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is .Union the best operator to use here? It will do equality checks for each item, even though the items will never be equal. Not a big deal but I would have said that .Concat would be a better choice here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I never knew that...

/// <summary>
/// Model for a single check annotation.
/// </summary>
public class CheckRunAnnotationModel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely documented ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

/// Gets or sets a collection of pull request Checks & Statuses
/// Gets or sets a collection of pull request Checks Suites
/// </summary>
public List<CheckSuiteModel> CheckSuites { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IReadOnlyList is used for the lists elsewhere in this model (and oops I didn't notice this with Statuses).

@meaghanlewis
Copy link
Contributor

This LGTM! Thanks for your work on this @StanleyGoldman

@StanleyGoldman StanleyGoldman merged commit 23e48d1 into master Aug 21, 2018
@StanleyGoldman StanleyGoldman deleted the features/check-suites branch August 30, 2018 22:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants