Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 18cc2db

Browse files
committed
Don't save drafts of empty comments.
1 parent 8e2afe2 commit 18cc2db

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/GitHub.App/ViewModels/PullRequestReviewCommentThreadViewModel.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,13 @@ public static (string key, string secondaryKey) GetDraftKeys(
227227

228228
protected override CommentDraft BuildDraft(ICommentViewModel comment)
229229
{
230-
return new PullRequestReviewCommentDraft
231-
{
232-
Body = comment.Body,
233-
Side = Side,
234-
UpdatedAt = DateTimeOffset.UtcNow,
235-
};
230+
return !string.IsNullOrEmpty(comment.Body) ?
231+
new PullRequestReviewCommentDraft
232+
{
233+
Body = comment.Body,
234+
Side = Side,
235+
UpdatedAt = DateTimeOffset.UtcNow,
236+
} : null;
236237
}
237238

238239
protected override (string key, string secondaryKey) GetDraftKeys(ICommentViewModel comment)

0 commit comments

Comments
 (0)