{
return null;
}
final long actorId = inRequest.getActorId();
NotificationBatch batch = new NotificationBatch();
// Adds post author as recipient
long postAuthor = activity.getActor().getId();
if (postAuthor != actorId)
{
batch.setRecipient(NotificationType.COMMENT_TO_PERSONAL_POST, postAuthor);
}
// Adds recipient who previously commented on this post
List<Long> commentToCommentedRecipients = new ArrayList<Long>();
for (long commentorId : commentorsDAO.execute(activityId))
{
if (commentorId != postAuthor && commentorId != actorId)
{
commentToCommentedRecipients.add(commentorId);
// this recipient list will keep replacing the old value in the map when new recipients are found
batch.getRecipients().put(NotificationType.COMMENT_TO_COMMENTED_POST, commentToCommentedRecipients);
}
}
// Add properties
batch.setProperty(NotificationPropertyKeys.ACTOR, PersonModelView.class, actorId);
batch.setProperty("stream", activity.getDestinationStream());
batch.setPropertyAlias(NotificationPropertyKeys.SOURCE, "stream");
batch.setProperty("activity", activity);
batch.setProperty("comment", CommentDTO.class, inRequest.getCommentId());
batch.setProperty(NotificationPropertyKeys.URL, UiUrlBuilder.relativeUrlForActivity(activityId));
return batch;
}