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

Commit 2b0970a

Browse files
Merge branch 'features/check-suite-annotations' into features/check-suite-annotations-inline
# Conflicts: # src/GitHub.App/ViewModels/GitHubPane/PullRequestCheckViewModel.cs # src/GitHub.Exports.Reactive/Models/IInlineAnnotationModel.cs # src/GitHub.Exports.Reactive/Models/InlineAnnotationModel.cs
2 parents 6877792 + 3ae3c1b commit 2b0970a

File tree

12 files changed

+54
-89
lines changed

12 files changed

+54
-89
lines changed

src/GitHub.App/SampleData/PullRequestAnnotationsViewModelDesigner.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public sealed class PullRequestAnnotationsViewModelDesigner : PanePageViewModelB
1616
public ILocalRepositoryModel LocalRepository { get; set; }
1717
public string RemoteRepositoryOwner { get; set; }
1818
public int PullRequestNumber { get; set; } = 123;
19-
public int CheckRunId { get; set; }
19+
public string CheckRunId { get; set; }
2020
public ReactiveCommand<Unit, Unit> NavigateToPullRequest { get; }
2121
public string PullRequestTitle { get; } = "Fixing stuff in this PR";
2222
public string CheckSuiteName { get; } = "Awesome Check Suite";
@@ -62,7 +62,7 @@ public sealed class PullRequestAnnotationsViewModelDesigner : PanePageViewModelB
6262
};
6363

6464
public Task InitializeAsync(ILocalRepositoryModel localRepository, IConnection connection, string owner, string repo,
65-
int pullRequestNumber, int checkRunId)
65+
int pullRequestNumber, string checkRunId)
6666
{
6767
return Task.CompletedTask;
6868
}

src/GitHub.App/SampleData/PullRequestCheckViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public sealed class PullRequestCheckViewModelDesigner : ViewModelBase, IPullRequ
2626

2727
public PullRequestCheckType CheckType { get; set; } = PullRequestCheckType.ChecksApi;
2828

29-
public int CheckRunId { get; set; }
29+
public string CheckRunId { get; set; }
3030

3131
public bool HasAnnotations { get; } = true;
3232
}

src/GitHub.App/ViewModels/GitHubPane/GitHubPaneViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public async Task NavigateTo(Uri uri)
272272
var owner = match.Groups["owner"].Value;
273273
var repo = match.Groups["repo"].Value;
274274
var number = int.Parse(match.Groups["number"].Value);
275-
var id = int.Parse(match.Groups["id"].Value);
275+
var id = match.Groups["id"].Value;
276276

277277
await ShowPullRequestCheckRun(owner, repo, number, id);
278278
}
@@ -330,7 +330,7 @@ public Task ShowPullRequestReviews(string owner, string repo, int number, string
330330
}
331331

332332
/// <inheritdoc/>
333-
public Task ShowPullRequestCheckRun(string owner, string repo, int number, int checkRunId)
333+
public Task ShowPullRequestCheckRun(string owner, string repo, int number, string checkRunId)
334334
{
335335
Guard.ArgumentNotNull(owner, nameof(owner));
336336
Guard.ArgumentNotNull(repo, nameof(repo));
@@ -513,8 +513,8 @@ static async Task<bool> IsValidRepository(ISimpleApiClient client)
513513

514514
static Regex CreateRoute(string route)
515515
{
516-
// Build RegEx from route (:foo to named group (?<foo>[\w_.-]+)).
517-
var routeFormat = "^" + new Regex("(:([a-z]+))\\b").Replace(route, @"(?<$2>[\w_.-]+)") + "$";
516+
// Build RegEx from route (:foo to named group (?<foo>[\w_.-=]+)).
517+
var routeFormat = "^" + new Regex("(:([a-z]+))\\b").Replace(route, @"(?<$2>[\w_.\-=]+)") + "$";
518518
return new Regex(routeFormat, RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
519519
}
520520
}

src/GitHub.App/ViewModels/GitHubPane/PullRequestAnnotationsViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public PullRequestAnnotationsViewModel(IPullRequestSessionManager sessionManager
4545

4646
/// <inheritdoc/>
4747
public async Task InitializeAsync(ILocalRepositoryModel localRepository, IConnection connection, string owner,
48-
string repo, int pullRequestNumber, int checkRunId)
48+
string repo, int pullRequestNumber, string checkRunId)
4949
{
5050
if (repo != localRepository.Name)
5151
{
@@ -79,7 +79,7 @@ public async Task InitializeAsync(ILocalRepositoryModel localRepository, IConnec
7979
public int PullRequestNumber { get; private set; }
8080

8181
/// <inheritdoc/>
82-
public int CheckRunId { get; private set; }
82+
public string CheckRunId { get; private set; }
8383

8484
/// <inheritdoc/>
8585
public ReactiveCommand<Unit, Unit> NavigateToPullRequest { get; private set; }
@@ -123,7 +123,7 @@ void Load(PullRequestDetailModel pullRequest)
123123
var checkSuiteRun = pullRequest
124124
.CheckSuites.SelectMany(checkSuite => checkSuite.CheckRuns
125125
.Select(checkRun => new{checkSuite, checkRun}))
126-
.First(arg => arg.checkRun.DatabaseId == CheckRunId);
126+
.First(arg => arg.checkRun.CheckRunId == CheckRunId);
127127

128128
CheckSuiteName = checkSuiteRun.checkSuite.ApplicationName;
129129
CheckRunName = checkSuiteRun.checkRun.Name;

src/GitHub.App/ViewModels/GitHubPane/PullRequestCheckViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static IEnumerable<IPullRequestCheckViewModel> Build(IViewViewModelFactor
104104

105105
var pullRequestCheckViewModel = (PullRequestCheckViewModel)viewViewModelFactory.CreateViewModel<IPullRequestCheckViewModel>();
106106
pullRequestCheckViewModel.CheckType = PullRequestCheckType.ChecksApi;
107-
pullRequestCheckViewModel.CheckRunId = arg.checkRun.DatabaseId;
107+
pullRequestCheckViewModel.CheckRunId = arg.checkRun.CheckRunId;
108108
pullRequestCheckViewModel.HasAnnotations = arg.checkRun.Annotations?.Any() ?? false;
109109
pullRequestCheckViewModel.Title = arg.checkRun.Name;
110110
pullRequestCheckViewModel.Description = arg.checkRun.Summary;
@@ -157,7 +157,7 @@ private void DoOpenDetailsUrl()
157157
public PullRequestCheckType CheckType { get; private set; }
158158

159159
/// <inheritdoc/>
160-
public int CheckRunId { get; private set; }
160+
public string CheckRunId { get; private set; }
161161

162162
/// <inheritdoc/>
163163
public bool HasAnnotations { get; private set; }

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

Lines changed: 0 additions & 58 deletions
This file was deleted.

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

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
namespace GitHub.Models
44
{
5-
/// <inheritdoc />
6-
public class InlineAnnotationModel: IInlineAnnotationModel
5+
/// <summary>
6+
/// Represents an inline annotation on an <see cref="IPullRequestSessionFile"/>.
7+
/// </summary>
8+
public class InlineAnnotationModel
79
{
810
readonly CheckSuiteModel checkSuite;
911
readonly CheckRunModel checkRun;
@@ -27,33 +29,54 @@ public InlineAnnotationModel(CheckSuiteModel checkSuite, CheckRunModel checkRun,
2729
this.annotation = annotation;
2830
}
2931

32+
/// <summary>
33+
/// Gets the annotation path.
34+
/// </summary>
3035
public string Path => annotation.Path;
3136

32-
/// <inheritdoc />
37+
/// <summary>
38+
/// Gets the start line of the annotation.
39+
/// </summary>
3340
public int StartLine => annotation.StartLine;
3441

35-
/// <inheritdoc />
42+
/// <summary>
43+
/// Gets the end line of the annotation.
44+
/// </summary>
3645
public int EndLine => annotation.EndLine;
37-
38-
/// <inheritdoc />
46+
47+
/// <summary>
48+
/// Gets the annotation level.
49+
/// </summary>
3950
public CheckAnnotationLevel AnnotationLevel => annotation.AnnotationLevel;
4051

41-
/// <inheritdoc />
52+
/// <summary>
53+
/// Gets the name of the check suite.
54+
/// </summary>
4255
public string CheckSuiteName => checkSuite.ApplicationName;
4356

44-
/// <inheritdoc />
57+
/// <summary>
58+
/// Gets the name of the check run.
59+
/// </summary>
4560
public string CheckRunName => checkRun.Name;
4661

47-
/// <inheritdoc />
62+
/// <summary>
63+
/// Gets the annotation title.
64+
/// </summary>
4865
public string Title => annotation.Title;
4966

50-
/// <inheritdoc />
67+
/// <summary>
68+
/// Gets the annotation message.
69+
/// </summary>
5170
public string Message => annotation.Message;
5271

53-
/// <inheritdoc />
72+
/// <summary>
73+
/// Gets the sha the check run was created on.
74+
/// </summary>
5475
public string HeadSha => checkSuite.HeadSha;
5576

56-
/// <inheritdoc />
77+
/// <summary>
78+
/// Gets the a descriptor for the line(s) reported.
79+
/// </summary>
5780
public string LineDescription => $"{StartLine}:{EndLine}";
5881
}
5982
}

src/GitHub.Exports.Reactive/ViewModels/GitHubPane/IPullRequestAnnotationsViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public interface IPullRequestAnnotationsViewModel : IPanePageViewModel
3939
/// <summary>
4040
/// Gets the id of the check run.
4141
/// </summary>
42-
int CheckRunId { get; }
42+
string CheckRunId { get; }
4343

4444
/// <summary>
4545
/// Gets the name of the check run.
@@ -76,6 +76,6 @@ Task InitializeAsync(
7676
string owner,
7777
string repo,
7878
int pullRequestNumber,
79-
int checkRunId);
79+
string checkRunId);
8080
}
8181
}

src/GitHub.Exports.Reactive/ViewModels/GitHubPane/IPullRequestCheckViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public interface IPullRequestCheckViewModel: IViewModel
4444
/// <summary>
4545
/// Gets the id of the check run.
4646
/// </summary>
47-
int CheckRunId { get; }
47+
string CheckRunId { get; }
4848

4949
/// <summary>
5050
/// Gets a flag to show this check run has annotations.

src/GitHub.Exports/Models/CheckRunModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ public class CheckRunModel
4646
/// <summary>
4747
/// The database id of a Check Run.
4848
/// </summary>
49-
public int DatabaseId { get; set; }
49+
public string CheckRunId { get; set; }
5050
}
5151
}

0 commit comments

Comments
 (0)