This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
src/GitHub.InlineReviews/Services Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,8 @@ await service.DeleteComment(
173173 RepositoryOwner ,
174174 User ,
175175 number ) ;
176+
177+ await RemoveComment ( number ) ;
176178 }
177179
178180 /// <inheritdoc/>
@@ -186,6 +188,7 @@ public async Task<IPullRequestReviewCommentModel> EditComment(
186188 number ,
187189 body ) ;
188190
191+ await ReplaceComment ( model ) ;
189192 return model ;
190193 }
191194
@@ -311,6 +314,24 @@ async Task AddComment(IPullRequestReviewCommentModel comment)
311314 await Update ( PullRequest ) ;
312315 }
313316
317+ async Task ReplaceComment ( IPullRequestReviewCommentModel comment )
318+ {
319+ PullRequest . ReviewComments = PullRequest . ReviewComments
320+ . Select ( model => model . Id == comment . Id ? comment : model )
321+ . ToList ( ) ;
322+
323+ await Update ( PullRequest ) ;
324+ }
325+
326+ async Task RemoveComment ( int commentId )
327+ {
328+ PullRequest . ReviewComments = PullRequest . ReviewComments
329+ . Where ( model => model . Id != commentId )
330+ . ToList ( ) ;
331+
332+ await Update ( PullRequest ) ;
333+ }
334+
314335 async Task AddReview ( IPullRequestReviewModel review )
315336 {
316337 PullRequest . Reviews = PullRequest . Reviews
You can’t perform that action at this time.
0 commit comments