From f88e573c980a3247b2e18bd7a202ab756ccc06db Mon Sep 17 00:00:00 2001 From: Jamie Cansdale Date: Mon, 4 Mar 2019 18:11:34 +0000 Subject: [PATCH] Add warning when viewing outdated PR file --- ...PullRequestReviewCommentThreadViewModel.cs | 4 ++++ .../Models/IInlineCommentThreadModel.cs | 5 +++++ ...PullRequestReviewCommentThreadViewModel.cs | 5 +++++ .../Models/InlineCommentThreadModel.cs | 5 +++++ .../Services/PullRequestSessionService.cs | 1 + .../Views/InlineCommentPeekView.xaml | 19 +++++++++++++++++++ src/GitHub.Resources/Resources.Designer.cs | 9 +++++++++ src/GitHub.Resources/Resources.resx | 3 +++ 8 files changed, 51 insertions(+) diff --git a/src/GitHub.App/ViewModels/PullRequestReviewCommentThreadViewModel.cs b/src/GitHub.App/ViewModels/PullRequestReviewCommentThreadViewModel.cs index f5ddb65bb6..3a6472778a 100644 --- a/src/GitHub.App/ViewModels/PullRequestReviewCommentThreadViewModel.cs +++ b/src/GitHub.App/ViewModels/PullRequestReviewCommentThreadViewModel.cs @@ -70,6 +70,9 @@ public IPullRequestSessionFile File /// public DiffSide Side { get; private set; } + /// + public bool IsOutdated { get; private set; } + /// public bool IsResolved { get; private set; } @@ -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) { diff --git a/src/GitHub.Exports.Reactive/Models/IInlineCommentThreadModel.cs b/src/GitHub.Exports.Reactive/Models/IInlineCommentThreadModel.cs index 802971c167..a4216ccd62 100644 --- a/src/GitHub.Exports.Reactive/Models/IInlineCommentThreadModel.cs +++ b/src/GitHub.Exports.Reactive/Models/IInlineCommentThreadModel.cs @@ -50,6 +50,11 @@ public interface IInlineCommentThreadModel /// string RelativePath { get; } + /// + /// Gets a value indicating whether the thread is outdated. + /// + bool IsOutdated { get; } + /// /// Gets a value indicating whether comment thread has been marked as resolved by a user. /// diff --git a/src/GitHub.Exports.Reactive/ViewModels/IPullRequestReviewCommentThreadViewModel.cs b/src/GitHub.Exports.Reactive/ViewModels/IPullRequestReviewCommentThreadViewModel.cs index b669927a07..0b99a44f31 100644 --- a/src/GitHub.Exports.Reactive/ViewModels/IPullRequestReviewCommentThreadViewModel.cs +++ b/src/GitHub.Exports.Reactive/ViewModels/IPullRequestReviewCommentThreadViewModel.cs @@ -36,6 +36,11 @@ public interface IPullRequestReviewCommentThreadViewModel : ICommentThreadViewMo /// DiffSide Side { get; } + /// + /// Gets a value indicating whether the thread is outdated. + /// + bool IsOutdated { get; } + /// /// Gets a value indicating whether comment thread has been marked as resolved by a user. /// diff --git a/src/GitHub.InlineReviews/Models/InlineCommentThreadModel.cs b/src/GitHub.InlineReviews/Models/InlineCommentThreadModel.cs index c47b0adf6f..9bbfea103a 100644 --- a/src/GitHub.InlineReviews/Models/InlineCommentThreadModel.cs +++ b/src/GitHub.InlineReviews/Models/InlineCommentThreadModel.cs @@ -29,6 +29,7 @@ public InlineCommentThreadModel( string commitSha, IList diffMatch, IEnumerable comments, + bool isOutdated, bool isResolved) { Guard.ArgumentNotNull(relativePath, nameof(relativePath)); @@ -40,6 +41,7 @@ public InlineCommentThreadModel( DiffLineType = diffMatch[0].Type; CommitSha = commitSha; RelativePath = relativePath; + IsOutdated = isOutdated; IsResolved = isResolved; foreach (var comment in comments) @@ -77,6 +79,9 @@ public int LineNumber /// public string RelativePath { get; } + /// + public bool IsOutdated { get; } + /// public bool IsResolved { get; } } diff --git a/src/GitHub.InlineReviews/Services/PullRequestSessionService.cs b/src/GitHub.InlineReviews/Services/PullRequestSessionService.cs index 871a62668b..c8864f7baf 100644 --- a/src/GitHub.InlineReviews/Services/PullRequestSessionService.cs +++ b/src/GitHub.InlineReviews/Services/PullRequestSessionService.cs @@ -145,6 +145,7 @@ public IReadOnlyList BuildCommentThreads( Comment = c, Review = pullRequest.Reviews.FirstOrDefault(x => x.Comments.Contains(c)), })), + reviewThread.IsOutdated, reviewThread.IsResolved); threads.Add(inlineThread); } diff --git a/src/GitHub.InlineReviews/Views/InlineCommentPeekView.xaml b/src/GitHub.InlineReviews/Views/InlineCommentPeekView.xaml index 0ca2f48b4c..ca1707e215 100644 --- a/src/GitHub.InlineReviews/Views/InlineCommentPeekView.xaml +++ b/src/GitHub.InlineReviews/Views/InlineCommentPeekView.xaml @@ -82,6 +82,25 @@ + + + + + + + + + + + /// Looks up a localized string similar to You are viewing an outdated version of this file. + /// + public static string YouAreViewingAnOutdatedVersionOfThisFile { + get { + return ResourceManager.GetString("YouAreViewingAnOutdatedVersionOfThisFile", resourceCulture); + } + } + /// /// Looks up a localized string similar to You have already cloned to this location. Click 'Open' to open the local repository.. /// diff --git a/src/GitHub.Resources/Resources.resx b/src/GitHub.Resources/Resources.resx index 84594d6ca8..9124f95e0f 100644 --- a/src/GitHub.Resources/Resources.resx +++ b/src/GitHub.Resources/Resources.resx @@ -884,4 +884,7 @@ https://git-scm.com/download/win This conversation was marked as resolved + + You are viewing an outdated version of this file + \ No newline at end of file