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

Commit d0c5fff

Browse files
Merge pull request #2253 from github/fixes/2245-comment-thread-resolved-status
Hide resolved comments from changes tree and indicate resolved comments on margin
2 parents 0c2a3df + e3be788 commit d0c5fff

25 files changed

+402
-78
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ public async Task Load(PullRequestDetailModel pullRequest)
364364

365365
Checks = (IReadOnlyList<IPullRequestCheckViewModel>)PullRequestCheckViewModel.Build(viewViewModelFactory, pullRequest)?.ToList() ?? Array.Empty<IPullRequestCheckViewModel>();
366366

367-
await Files.InitializeAsync(Session);
367+
// Only show unresolved comments
368+
await Files.InitializeAsync(Session, c => !c.IsResolved);
368369

369370
var localBranches = await pullRequestsService.GetLocalBranches(LocalRepository, pullRequest).ToList();
370371

src/GitHub.App/ViewModels/PullRequestReviewCommentThreadViewModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public IPullRequestSessionFile File
7070
/// <inheritdoc/>
7171
public DiffSide Side { get; private set; }
7272

73+
/// <inheritdoc/>
74+
public bool IsResolved { get; private set; }
75+
7376
public bool IsNewThread
7477
{
7578
get => isNewThread;
@@ -97,6 +100,7 @@ public async Task InitializeAsync(
97100
File = file;
98101
LineNumber = thread.LineNumber;
99102
Side = thread.DiffLineType == DiffChangeType.Delete ? DiffSide.Left : DiffSide.Right;
103+
IsResolved = thread.IsResolved;
100104

101105
foreach (var comment in thread.Comments)
102106
{

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,10 @@ public interface IInlineCommentThreadModel
4949
/// Gets the relative path to the file that the thread is on.
5050
/// </summary>
5151
string RelativePath { get; }
52+
53+
/// <summary>
54+
/// Gets a value indicating whether comment thread has been marked as resolved by a user.
55+
/// </summary>
56+
bool IsResolved { get; }
5257
}
5358
}

src/GitHub.Exports.Reactive/ViewModels/IPullRequestReviewCommentThreadViewModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public interface IPullRequestReviewCommentThreadViewModel : ICommentThreadViewMo
3636
/// </summary>
3737
DiffSide Side { get; }
3838

39+
/// <summary>
40+
/// Gets a value indicating whether comment thread has been marked as resolved by a user.
41+
/// </summary>
42+
bool IsResolved { get; }
43+
3944
/// <summary>
4045
/// Gets a value indicating whether the thread is a new thread being authored, that is not
4146
/// yet present on the server.

src/GitHub.Exports/Models/PullRequestReviewThreadModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public class PullRequestReviewThreadModel
3333
/// </summary>
3434
public bool IsOutdated { get; set; }
3535

36+
/// <summary>
37+
/// Gets or sets a value indicating whether the thread is resolved.
38+
/// </summary>
39+
public bool IsResolved { get; set; }
40+
3641
/// <summary>
3742
/// Gets or sets the line position in the diff that the thread starts on.
3843
/// </summary>

src/GitHub.InlineReviews/Models/InlineCommentThreadModel.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public InlineCommentThreadModel(
2828
string relativePath,
2929
string commitSha,
3030
IList<DiffLine> diffMatch,
31-
IEnumerable<InlineCommentModel> comments)
31+
IEnumerable<InlineCommentModel> comments,
32+
bool isResolved)
3233
{
3334
Guard.ArgumentNotNull(relativePath, nameof(relativePath));
3435
Guard.ArgumentNotNull(commitSha, nameof(commitSha));
@@ -39,6 +40,7 @@ public InlineCommentThreadModel(
3940
DiffLineType = diffMatch[0].Type;
4041
CommitSha = commitSha;
4142
RelativePath = relativePath;
43+
IsResolved = isResolved;
4244

4345
foreach (var comment in comments)
4446
{
@@ -74,5 +76,8 @@ public int LineNumber
7476

7577
/// <inheritdoc/>
7678
public string RelativePath { get; }
79+
80+
/// <inheritdoc/>
81+
public bool IsResolved { get; }
7782
}
7883
}

0 commit comments

Comments
 (0)