Search in sources :

Example 1 with PostingCommentsChangedEvent

use of org.moera.node.model.event.PostingCommentsChangedEvent in project moera-node by MoeraOrg.

the class CommentReceptor method added.

@LiberinMapping
public void added(CommentAddedLiberin liberin) {
    Comment comment = liberin.getComment();
    Posting posting = liberin.getPosting();
    if (comment.getCurrentRevision().getSignature() != null) {
        UUID repliedToId = comment.getRepliedTo() != null ? comment.getRepliedTo().getId() : null;
        send(Directions.postingCommentsSubscribers(posting.getNodeId(), posting.getId()), new PostingCommentAddedNotification(posting.getId(), posting.getCurrentRevision().getHeading(), comment.getId(), comment.getOwnerName(), comment.getOwnerFullName(), new AvatarImage(comment.getOwnerAvatarMediaFile(), comment.getOwnerAvatarShape()), comment.getCurrentRevision().getHeading(), repliedToId));
    }
    notifyReplyAdded(posting, comment);
    notifyMentioned(posting, comment.getId(), comment.getOwnerName(), comment.getOwnerFullName(), new AvatarImage(comment.getOwnerAvatarMediaFile(), comment.getOwnerAvatarShape()), comment.getCurrentRevision(), null);
    send(liberin, new CommentAddedEvent(comment));
    send(liberin, new PostingCommentsChangedEvent(posting));
    send(Directions.postingSubscribers(posting.getNodeId(), posting.getId()), new PostingCommentsUpdatedNotification(posting.getId(), posting.getTotalChildren()));
}
Also used : Comment(org.moera.node.data.Comment) CommentAddedEvent(org.moera.node.model.event.CommentAddedEvent) Posting(org.moera.node.data.Posting) PostingCommentsChangedEvent(org.moera.node.model.event.PostingCommentsChangedEvent) UUID(java.util.UUID) AvatarImage(org.moera.node.model.AvatarImage) PostingCommentAddedNotification(org.moera.node.model.notification.PostingCommentAddedNotification) PostingCommentsUpdatedNotification(org.moera.node.model.notification.PostingCommentsUpdatedNotification) LiberinMapping(org.moera.node.liberin.LiberinMapping)

Example 2 with PostingCommentsChangedEvent

use of org.moera.node.model.event.PostingCommentsChangedEvent in project moera-node by MoeraOrg.

the class PostingReceptor method commentTotalsUpdated.

@LiberinMapping
public void commentTotalsUpdated(PostingCommentTotalsUpdatedLiberin liberin) {
    Posting posting = liberin.getPosting();
    send(liberin, new PostingCommentsChangedEvent(posting));
    send(Directions.postingSubscribers(posting.getNodeId(), posting.getId()), new PostingCommentsUpdatedNotification(posting.getId(), liberin.getTotal()));
}
Also used : Posting(org.moera.node.data.Posting) PostingCommentsChangedEvent(org.moera.node.model.event.PostingCommentsChangedEvent) PostingCommentsUpdatedNotification(org.moera.node.model.notification.PostingCommentsUpdatedNotification) LiberinMapping(org.moera.node.liberin.LiberinMapping)

Example 3 with PostingCommentsChangedEvent

use of org.moera.node.model.event.PostingCommentsChangedEvent in project moera-node by MoeraOrg.

the class CommentReceptor method deleted.

@LiberinMapping
public void deleted(CommentDeletedLiberin liberin) {
    Comment comment = liberin.getComment();
    Posting posting = comment.getPosting();
    notifyReplyDeleted(posting, comment);
    notifyMentioned(posting, comment.getId(), comment.getOwnerName(), comment.getOwnerFullName(), new AvatarImage(comment.getOwnerAvatarMediaFile(), comment.getOwnerAvatarShape()), null, liberin.getLatestRevision());
    send(Directions.postingSubscribers(comment.getNodeId(), posting.getId()), new PostingCommentsUpdatedNotification(posting.getId(), posting.getTotalChildren()));
    send(Directions.postingCommentsSubscribers(comment.getNodeId(), posting.getId()), new PostingCommentDeletedNotification(posting.getId(), comment.getId(), comment.getOwnerName(), comment.getOwnerFullName(), new AvatarImage(comment.getOwnerAvatarMediaFile(), comment.getOwnerAvatarShape())));
    send(liberin, new CommentDeletedEvent(comment));
    send(liberin, new PostingCommentsChangedEvent(posting));
}
Also used : Comment(org.moera.node.data.Comment) Posting(org.moera.node.data.Posting) PostingCommentsChangedEvent(org.moera.node.model.event.PostingCommentsChangedEvent) PostingCommentDeletedNotification(org.moera.node.model.notification.PostingCommentDeletedNotification) AvatarImage(org.moera.node.model.AvatarImage) PostingCommentsUpdatedNotification(org.moera.node.model.notification.PostingCommentsUpdatedNotification) CommentDeletedEvent(org.moera.node.model.event.CommentDeletedEvent) LiberinMapping(org.moera.node.liberin.LiberinMapping)

Aggregations

Posting (org.moera.node.data.Posting)3 LiberinMapping (org.moera.node.liberin.LiberinMapping)3 PostingCommentsChangedEvent (org.moera.node.model.event.PostingCommentsChangedEvent)3 PostingCommentsUpdatedNotification (org.moera.node.model.notification.PostingCommentsUpdatedNotification)3 Comment (org.moera.node.data.Comment)2 AvatarImage (org.moera.node.model.AvatarImage)2 UUID (java.util.UUID)1 CommentAddedEvent (org.moera.node.model.event.CommentAddedEvent)1 CommentDeletedEvent (org.moera.node.model.event.CommentDeletedEvent)1 PostingCommentAddedNotification (org.moera.node.model.notification.PostingCommentAddedNotification)1 PostingCommentDeletedNotification (org.moera.node.model.notification.PostingCommentDeletedNotification)1