use of com.cloudogu.scm.review.comment.service.BasicCommentEvent in project scm-review-plugin by scm-manager.
the class RemoveReviewMarksOnChangedCommentsHook method checkForLocation.
private <C extends BasicComment, T extends BasicCommentEvent<C>> void checkForLocation(T event, Function<C, Location> locationExtractor) {
if (event.getEventType() == HandlerEventType.DELETE) {
return;
}
Location location = locationExtractor.apply(event.getItem());
if (location == null) {
return;
}
Collection<ReviewMark> reviewMarksToBeRemoved = event.getPullRequest().getReviewMarks().stream().filter(mark -> mark.getFile().equals(location.getFile())).collect(Collectors.toList());
pullRequestService.removeReviewMarks(event.getRepository(), event.getPullRequest().getId(), reviewMarksToBeRemoved);
}
Aggregations