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

Commit 6dcd957

Browse files
committed
Add message for pending review comments.
If the user has pending review comments on the server then we can't post new comments. The correct way to test for this would be to make a request to `/repos/:owner/:repo/pulls/:number/reviews` and check for comments with a `PENDING` state. For the moment however we'll just display a message.
1 parent 2e3cf30 commit 6dcd957

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/GitHub.InlineReviews/ViewModels/CommentViewModel.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using GitHub.Extensions;
88
using GitHub.Models;
99
using GitHub.UI;
10+
using Octokit;
1011
using ReactiveUI;
1112

1213
namespace GitHub.InlineReviews.ViewModels
@@ -154,7 +155,18 @@ async Task DoCommitEdit(object unused)
154155
}
155156
catch (Exception e)
156157
{
157-
ErrorMessage = e.Message;
158+
var message = e.Message;
159+
160+
if (e is ApiValidationException)
161+
{
162+
// HACK: If the user has pending review comments on the server then we can't
163+
// post new comments. The correct way to test for this would be to make a
164+
// request to /repos/:owner/:repo/pulls/:number/reviews and check for comments
165+
// with a PENDING state. For the moment however we'll just display a message.
166+
message += ". Do you have pending review comments?";
167+
}
168+
169+
ErrorMessage = message;
158170
}
159171
}
160172

0 commit comments

Comments
 (0)