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

Show outdated comments #2260

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public IPullRequestSessionFile File
/// <inheritdoc/>
public DiffSide Side { get; private set; }

/// <inheritdoc/>
public bool IsOutdated { get; private set; }

/// <inheritdoc/>
public bool IsResolved { get; private set; }

Expand Down Expand Up @@ -101,6 +104,7 @@ public async Task InitializeAsync(
LineNumber = thread.LineNumber;
Side = thread.DiffLineType == DiffChangeType.Delete ? DiffSide.Left : DiffSide.Right;
IsResolved = thread.IsResolved;
IsOutdated = thread.IsOutdated;

foreach (var comment in thread.Comments)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public interface IInlineCommentThreadModel
/// </summary>
string RelativePath { get; }

/// <summary>
/// Gets a value indicating whether the thread is outdated.
/// </summary>
bool IsOutdated { get; }

/// <summary>
/// Gets a value indicating whether comment thread has been marked as resolved by a user.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public interface IPullRequestReviewCommentThreadViewModel : ICommentThreadViewMo
/// </summary>
DiffSide Side { get; }

/// <summary>
/// Gets a value indicating whether the thread is outdated.
/// </summary>
bool IsOutdated { get; }

/// <summary>
/// Gets a value indicating whether comment thread has been marked as resolved by a user.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions src/GitHub.InlineReviews/Models/InlineCommentThreadModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public InlineCommentThreadModel(
string commitSha,
IList<DiffLine> diffMatch,
IEnumerable<InlineCommentModel> comments,
bool isOutdated,
bool isResolved)
{
Guard.ArgumentNotNull(relativePath, nameof(relativePath));
Expand All @@ -40,6 +41,7 @@ public InlineCommentThreadModel(
DiffLineType = diffMatch[0].Type;
CommitSha = commitSha;
RelativePath = relativePath;
IsOutdated = isOutdated;
IsResolved = isResolved;

foreach (var comment in comments)
Expand Down Expand Up @@ -77,6 +79,9 @@ public int LineNumber
/// <inheritdoc/>
public string RelativePath { get; }

/// <inheritdoc/>
public bool IsOutdated { get; }

/// <inheritdoc/>
public bool IsResolved { get; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public IReadOnlyList<IInlineCommentThreadModel> BuildCommentThreads(
Comment = c,
Review = pullRequest.Reviews.FirstOrDefault(x => x.Comments.Contains(c)),
})),
reviewThread.IsOutdated,
reviewThread.IsResolved);
threads.Add(inlineThread);
}
Expand Down
19 changes: 19 additions & 0 deletions src/GitHub.InlineReviews/Views/InlineCommentPeekView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@
</DockPanel>
</Border>

<Border DockPanel.Dock="Top"
Background="{DynamicResource {x:Static SystemColors.InfoBrushKey}}"
Padding="8">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Thread.IsOutdated}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<DockPanel>
<ui:OcticonImage DockPanel.Dock="Left" Icon="alert" Margin="0 0 8 0"/>
<TextBlock TextWrapping="Wrap" Text="{x:Static ghfvs:Resources.YouAreViewingAnOutdatedVersionOfThisFile}"/>
</DockPanel>
</Border>

<Border DockPanel.Dock="Top"
BorderThickness="0 0 0 1"
Background="{DynamicResource VsBrush.CommandBarOptionsBackground}"
Expand Down
9 changes: 9 additions & 0 deletions src/GitHub.Resources/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/GitHub.Resources/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -884,4 +884,7 @@ https://git-scm.com/download/win</value>
<data name="ThisConversationWasMarkedAsResolved" xml:space="preserve">
<value>This conversation was marked as resolved</value>
</data>
<data name="YouAreViewingAnOutdatedVersionOfThisFile" xml:space="preserve">
<value>You are viewing an outdated version of this file</value>
</data>
</root>