Skip to content

Commit c8661d2

Browse files
authored
Comments created with "Add a Comment" say "pending" (microsoft#2823)
Fixes microsoft#2822
1 parent 17b3d36 commit c8661d2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/github/pullRequestModel.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,16 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
316316

317317
this.hasPendingReview = false;
318318
await this.updateDraftModeContext();
319+
const reviewEvent = parseGraphQLReviewEvent(data!.submitPullRequestReview.pullRequestReview, this.githubRepository);
319320

320-
return parseGraphQLReviewEvent(data!.submitPullRequestReview.pullRequestReview, this.githubRepository);
321+
const threadWithComment = this._reviewThreadsCache.find(thread =>
322+
thread.comments.length ? (thread.comments[0].pullRequestReviewId === reviewEvent.id) : undefined,
323+
);
324+
if (threadWithComment) {
325+
threadWithComment.comments = reviewEvent.comments;
326+
this._onDidChangeReviewThreads.fire({ added: [], changed: [threadWithComment], removed: [] });
327+
}
328+
return reviewEvent;
321329
} else {
322330
throw new Error(`Submitting review failed, no pending review for current pull request: ${this.number}.`);
323331
}

0 commit comments

Comments
 (0)