Skip to content

Commit c06df98

Browse files
authored
Can't leave a comment in PR webviewview without a pending review (#3493)
Fixes #3480
1 parent 62a595c commit c06df98

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/github/pullRequestModel.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,14 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
331331
* @param body The summary comment text.
332332
*/
333333
async submitReview(event?: ReviewEvent, body?: string): Promise<CommonReviewEvent> {
334-
const pendingReviewId = await this.getPendingReviewId();
334+
let pendingReviewId = await this.getPendingReviewId();
335335
const { mutate, schema } = await this.githubRepository.ensure();
336336

337+
if (!pendingReviewId && (event === ReviewEvent.Comment)) {
338+
// Create a new review so that we can comment on it.
339+
pendingReviewId = await this.startReview();
340+
}
341+
337342
if (pendingReviewId) {
338343
const { data } = await mutate<SubmitReviewResponse>({
339344
mutation: schema.SubmitReview,

0 commit comments

Comments
 (0)