NotificationEvent.add(notiEvent);
}
public static NotificationEvent afterReviewed(PullRequest pullRequest, PullRequestReviewAction reviewAction) {
String title = formatReplyTitle(pullRequest);
Resource resource = pullRequest.asResource();
Set<User> receivers = pullRequest.getWatchers();
receivers.add(pullRequest.contributor);
User reviewer = UserApp.currentUser();
receivers.remove(reviewer);
NotificationEvent notiEvent = new NotificationEvent();
notiEvent.created = new Date();
notiEvent.title = title;
notiEvent.senderId = reviewer.id;
notiEvent.receivers = receivers;
notiEvent.resourceId = resource.getId();
notiEvent.resourceType = resource.getType();
notiEvent.eventType = EventType.PULL_REQUEST_REVIEW_STATE_CHANGED;
notiEvent.oldValue = reviewAction.getOppositAction().name();
notiEvent.newValue = reviewAction.name();
add(notiEvent);