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

Commit 2865433

Browse files
More backporting and cleaning
1 parent c3c03dd commit 2865433

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

src/GitHub.App/SampleData/PullRequestDetailViewModelDesigner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public PullRequestDetailViewModelDesigner()
122122
public ReactiveCommand<Unit> Checkout { get; }
123123
public ReactiveCommand<Unit> Pull { get; }
124124
public ReactiveCommand<Unit> Push { get; }
125+
public ReactiveCommand<Unit> SyncSubmodules { get; }
125126
public ReactiveCommand<object> OpenOnGitHub { get; }
126127
public ReactiveCommand<object> ShowReview { get; }
127128
public ReactiveCommand<object> ShowAnnotations { get; }

src/GitHub.App/Services/FromGraphQlExtensions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,10 @@ public static PullRequestReviewState FromGraphQl(this Octokit.GraphQL.Model.Pull
103103
}
104104
}
105105

106-
public static CheckAnnotationLevel? FromGraphQl(this Octokit.GraphQL.Model.CheckAnnotationLevel? value)
106+
public static CheckAnnotationLevel FromGraphQl(this Octokit.GraphQL.Model.CheckAnnotationLevel value)
107107
{
108108
switch (value)
109109
{
110-
case null:
111-
return null;
112110
case Octokit.GraphQL.Model.CheckAnnotationLevel.Failure:
113111
return CheckAnnotationLevel.Failure;
114112
case Octokit.GraphQL.Model.CheckAnnotationLevel.Notice:

src/GitHub.Exports.Reactive/Models/IInlineAnnotationModel.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@
55
/// </summary>
66
public interface IInlineAnnotationModel
77
{
8+
/// <summary>
9+
/// Gets the start line of the annotation.
10+
/// </summary>
811
int StartLine { get; }
12+
13+
/// <summary>
14+
/// Gets the end line of the annotation.
15+
/// </summary>
916
int EndLine { get; }
17+
18+
/// <summary>
19+
/// Gets the annotation level.
20+
/// </summary>
1021
CheckAnnotationLevel AnnotationLevel { get; }
1122
}
1223
}

src/GitHub.Exports.Reactive/Models/InlineAnnotationModel.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

33
namespace GitHub.Models
44
{
5+
/// <inheritdoc />
56
public class InlineAnnotationModel: IInlineAnnotationModel
67
{
78
private CheckRunModel checkRun;
89
private CheckRunAnnotationModel annotation;
910

11+
/// <summary>
12+
/// Initializes the <see cref="InlineAnnotationModel"/>.
13+
/// </summary>
14+
/// <param name="checkRun">The check run model.</param>
15+
/// <param name="annotation">The annotation model.</param>
1016
public InlineAnnotationModel(CheckRunModel checkRun, CheckRunAnnotationModel annotation)
1117
{
1218
Guard.ArgumentNotNull(annotation.AnnotationLevel, nameof(annotation.AnnotationLevel));
@@ -15,10 +21,13 @@ public InlineAnnotationModel(CheckRunModel checkRun, CheckRunAnnotationModel ann
1521
this.annotation = annotation;
1622
}
1723

24+
/// <inheritdoc />
1825
public int StartLine => annotation.StartLine;
1926

27+
/// <inheritdoc />
2028
public int EndLine => annotation.EndLine;
2129

22-
public CheckAnnotationLevel AnnotationLevel => annotation.AnnotationLevel.Value;
30+
/// <inheritdoc />
31+
public CheckAnnotationLevel AnnotationLevel => annotation.AnnotationLevel;
2332
}
2433
}

src/GitHub.Exports/Models/AnnotationModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ public class CheckRunAnnotationModel
3333
/// <summary>
3434
/// The annotation's severity level.
3535
/// </summary>
36-
public CheckAnnotationLevel? AnnotationLevel { get; set; }
36+
public CheckAnnotationLevel AnnotationLevel { get; set; }
3737
}
3838
}

src/GitHub.InlineReviews/Services/PullRequestSessionService.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public IReadOnlyList<IInlineAnnotationModel> BuildAnnotations(
108108
?.SelectMany(checkSuite => checkSuite.CheckRuns.Select(checkRun => new { checkSuite, checkRun}))
109109
.SelectMany(arg =>
110110
arg.checkRun.Annotations
111-
.Where(annotation => annotation.Path == relativePath && annotation.AnnotationLevel.HasValue)
111+
.Where(annotation => annotation.Path == relativePath)
112112
.Select(annotation => new InlineAnnotationModel(arg.checkRun, annotation)))
113113
.OrderBy(tuple => tuple.StartLine)
114114
.ToArray();
@@ -789,9 +789,20 @@ async Task<LastCommitAdapter> GetPullRequestLastCommitAdapter(HostAddress addres
789789
{
790790
Conclusion = run.Conclusion.FromGraphQl(),
791791
Status = run.Status.FromGraphQl(),
792+
DatabaseId = run.DatabaseId.Value,
792793
Name = run.Name,
793794
DetailsUrl = run.Permalink,
794795
Summary = run.Summary,
796+
Annotations = run.Annotations(null, null, null, null).AllPages()
797+
.Select(annotation => new CheckRunAnnotationModel
798+
{
799+
Title = annotation.Title,
800+
Message = annotation.Message,
801+
Path = annotation.Path,
802+
AnnotationLevel = annotation.AnnotationLevel.Value.FromGraphQl(),
803+
StartLine = annotation.Location.Start.Line,
804+
EndLine = annotation.Location.End.Line,
805+
}).ToList()
795806
}).ToList()
796807
}).ToList(),
797808
Statuses = commit.Commit.Status

0 commit comments

Comments
 (0)