Search in sources :

Example 46 with PullRequest

use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.

the class EmailNotificationHook method handlePullRequestApproval.

@Subscribe
public void handlePullRequestApproval(PullRequestApprovalEvent event) {
    PullRequest pullRequest = event.getPullRequest();
    handleEvent(event, new PullRequestApprovalMailTextResolver(event), pullRequest, getSubscribersWithoutCurrentUser(pullRequest));
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Subscribe(com.github.legman.Subscribe)

Example 47 with PullRequest

use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.

the class EmailNotificationHook method handleRejectedPullRequest.

@Subscribe
public void handleRejectedPullRequest(PullRequestRejectedEvent event) {
    PullRequest pullRequest = event.getPullRequest();
    handleEvent(event, new PullRequestRejectedMailTextResolver(event), pullRequest, getSubscribersWithoutCurrentUser(pullRequest));
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Subscribe(com.github.legman.Subscribe)

Example 48 with PullRequest

use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.

the class EmailNotificationHook method handlePullRequestEvents.

@Subscribe
public void handlePullRequestEvents(PullRequestEvent event) {
    PullRequest pullRequest = event.getPullRequest();
    EMailRecipientHelper eMailRecipientHelper = new EMailRecipientHelper(pullRequest);
    Set<String> subscriberWithoutReviewers = eMailRecipientHelper.getSubscriberWithoutReviewers();
    Set<String> reviewers = eMailRecipientHelper.getSubscribingReviewers();
    handleEvent(event, new PullRequestEventMailTextResolver(event, false), pullRequest, subscriberWithoutReviewers);
    handleEvent(event, new PullRequestEventMailTextResolver(event, true), pullRequest, reviewers);
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Subscribe(com.github.legman.Subscribe)

Example 49 with PullRequest

use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.

the class EmailNotificationHook method handleReplyEvents.

@Subscribe
public void handleReplyEvents(ReplyEvent event) {
    PullRequest pullRequest = event.getPullRequest();
    Set<String> authorsInThread = getAuthorsInThread(event);
    Set<String> subscribers = getSubscribersWithoutCurrentUser(pullRequest);
    subscribers.removeAll(authorsInThread);
    handleEvent(event, new CommentEventMailTextResolver(event), pullRequest, subscribers);
    handleEvent(event, new ReplyEventMailTextResolver(event), pullRequest, authorsInThread);
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Subscribe(com.github.legman.Subscribe)

Example 50 with PullRequest

use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.

the class EmailNotificationHook method handleMergedPullRequest.

@Subscribe
public void handleMergedPullRequest(PullRequestMergedEvent event) {
    PullRequest pullRequest = event.getPullRequest();
    handleEvent(event, new PullRequestMergedMailTextResolver(event), pullRequest, getSubscribersWithoutCurrentUser(pullRequest));
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Subscribe(com.github.legman.Subscribe)

Aggregations

PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)82 Repository (sonia.scm.repository.Repository)27 Test (org.junit.jupiter.api.Test)20 Test (org.junit.Test)18 TestData.createPullRequest (com.cloudogu.scm.review.TestData.createPullRequest)17 MockHttpRequest (org.jboss.resteasy.mock.MockHttpRequest)16 Subscribe (com.github.legman.Subscribe)13 SubjectAware (com.github.sdorra.shiro.SubjectAware)13 NamespaceAndName (sonia.scm.repository.NamespaceAndName)13 User (sonia.scm.user.User)11 DisplayUser (sonia.scm.user.DisplayUser)10 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 Optional (java.util.Optional)7 Comment (com.cloudogu.scm.review.comment.service.Comment)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 PermissionCheck (com.cloudogu.scm.review.PermissionCheck)5 PullRequestService (com.cloudogu.scm.review.pullrequest.service.PullRequestService)5 Operation (io.swagger.v3.oas.annotations.Operation)5 List (java.util.List)5