This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +14
-5
lines changed
GitHub.Exports.Reactive/ViewModels
test/GitHub.App.UnitTests/ViewModels Expand file tree Collapse file tree 4 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,12 @@ await vm.InitializeAsync(
106106 if ( addPlaceholder )
107107 {
108108 var vm = factory . CreateViewModel < IPullRequestReviewCommentViewModel > ( ) ;
109- await vm . InitializeAsPlaceholderAsync ( session , this , false ) . ConfigureAwait ( true ) ;
109+
110+ await vm . InitializeAsPlaceholderAsync (
111+ session ,
112+ this ,
113+ review . State == PullRequestReviewState . Pending ,
114+ false ) . ConfigureAwait ( true ) ;
110115
111116 var ( key , secondaryKey ) = GetDraftKeys ( vm ) ;
112117 var draft = await DraftStore . GetDraft < PullRequestReviewCommentDraft > ( key , secondaryKey ) . ConfigureAwait ( true ) ;
@@ -140,7 +145,7 @@ public async Task InitializeNewAsync(
140145 IsNewThread = true ;
141146
142147 var vm = factory . CreateViewModel < IPullRequestReviewCommentViewModel > ( ) ;
143- await vm . InitializeAsPlaceholderAsync ( session , this , isEditing ) . ConfigureAwait ( false ) ;
148+ await vm . InitializeAsPlaceholderAsync ( session , this , session . HasPendingReview , isEditing ) . ConfigureAwait ( false ) ;
144149
145150 var ( key , secondaryKey ) = GetDraftKeys ( vm ) ;
146151 var draft = await DraftStore . GetDraft < PullRequestReviewCommentDraft > ( key , secondaryKey ) . ConfigureAwait ( true ) ;
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ public async Task InitializeAsync(
6767 public async Task InitializeAsPlaceholderAsync (
6868 IPullRequestSession session ,
6969 ICommentThreadViewModel thread ,
70+ bool isPending ,
7071 bool isEditing )
7172 {
7273 Guard . ArgumentNotNull ( session , nameof ( session ) ) ;
@@ -77,6 +78,7 @@ await InitializeAsync(
7778 null ,
7879 isEditing ? CommentEditState . Editing : CommentEditState . Placeholder ) . ConfigureAwait ( true ) ;
7980 this . session = session ;
81+ IsPending = isPending ;
8082 }
8183
8284 /// <inheritdoc/>
@@ -101,7 +103,7 @@ async Task DoStartReview()
101103
102104 try
103105 {
104- await session . StartReview ( ) . ConfigureAwait ( false ) ;
106+ await session . StartReview ( ) . ConfigureAwait ( true ) ;
105107 await CommitEdit . Execute ( ) ;
106108 }
107109 finally
Original file line number Diff line number Diff line change @@ -55,10 +55,12 @@ Task InitializeAsync(
5555 /// </summary>
5656 /// <param name="session">The pull request session.</param>
5757 /// <param name="thread">The thread that the comment is a part of.</param>
58+ /// <param name="isPending">Whether the comment thread is a pending review thread.</param>
5859 /// <param name="isEditing">Whether to start the placeholder in edit mode.</param>
5960 Task InitializeAsPlaceholderAsync (
6061 IPullRequestSession session ,
6162 ICommentThreadViewModel thread ,
63+ bool isPending ,
6264 bool isEditing ) ;
6365 }
6466}
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public async Task CanBeExecutedForPlaceholders()
5656 var commentService = Substitute . For < ICommentService > ( ) ;
5757 var target = new PullRequestReviewCommentViewModel ( commentService ) ;
5858
59- await target . InitializeAsPlaceholderAsync ( session , thread , false ) ;
59+ await target . InitializeAsPlaceholderAsync ( session , thread , false , false ) ;
6060
6161 Assert . That ( target . BeginEdit . CanExecute ( new object ( ) ) , Is . True ) ;
6262 }
@@ -100,7 +100,7 @@ public async Task CannotBeExecutedForPlaceholders()
100100 var commentService = Substitute . For < ICommentService > ( ) ;
101101 var target = new PullRequestReviewCommentViewModel ( commentService ) ;
102102
103- await target . InitializeAsPlaceholderAsync ( session , thread , false ) ;
103+ await target . InitializeAsPlaceholderAsync ( session , thread , false , false ) ;
104104
105105 Assert . That ( target . Delete . CanExecute ( new object ( ) ) , Is . False ) ;
106106 }
You can’t perform that action at this time.
0 commit comments