Hi, I’m currently developing a merge check that counts the unresolved threads of a PR.
This works, but is only refreshed after CTRL-R.
In contrast, the resolved comments (tasks) are refreshed instantly.
Could it be that there is no event for the resolution of a thread? Why could it be that there is no refresh?
My code is like this
@Nonnull
@Override
public RepositoryHookResult preUpdate(@Nonnull PreRepositoryHookContext context,
@Nonnull PullRequestMergeHookRequest request) {
PullRequest pr = request.getPullRequest();
AtomicInteger count = new AtomicInteger();
CommentSearchRequest search = new CommentSearchRequest.Builder(pr).build();
Page<CommentThread> threads = comments.searchThreads(search, new PageRequestImpl(0, 100000));
threads.forEach(t -> {
if (!t.isResolved()) {
count.incrementAndGet();
}
});
if (count.get() != 0) {
return RepositoryHookResult.rejected("Rejected",
"Not all conversations have been resolved (" + count.get() + ")");
}
return RepositoryHookResult.accepted();
}