Search in sources :

Example 16 with LiberinMapping

use of org.moera.node.liberin.LiberinMapping 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 17 with LiberinMapping

use of org.moera.node.liberin.LiberinMapping in project moera-node by MoeraOrg.

the class PostingReceptor method added.

@LiberinMapping
public void added(PostingAddedLiberin liberin) {
    Posting posting = liberin.getPosting();
    if (posting.isOriginal()) {
        notifyMentioned(liberin, posting.getId(), posting.getCurrentRevision(), null, posting.getOwnerName());
    }
    send(liberin, new PostingAddedEvent(posting));
    if (liberin.getFeeds() != null) {
        liberin.getFeeds().forEach(fn -> send(Directions.feedSubscribers(liberin.getNodeId(), fn), new FeedPostingAddedNotification(fn, posting.getId())));
    }
}
Also used : PostingAddedEvent(org.moera.node.model.event.PostingAddedEvent) Posting(org.moera.node.data.Posting) FeedPostingAddedNotification(org.moera.node.model.notification.FeedPostingAddedNotification) LiberinMapping(org.moera.node.liberin.LiberinMapping)

Example 18 with LiberinMapping

use of org.moera.node.liberin.LiberinMapping in project moera-node by MoeraOrg.

the class ProfileReceptor method updated.

@LiberinMapping
public void updated(ProfileUpdatedLiberin liberin) {
    send(liberin, new ProfileUpdatedEvent());
    send(liberin, new NodeNameChangedEvent(liberin.getNodeName(), liberin.getOptions(), liberin.getAvatar()));
    send(Directions.profileSubscribers(liberin.getNodeId()), new ProfileUpdatedNotification());
    if (!Objects.equals(liberin.getOptions().getString("profile.email"), liberin.getOldEmail())) {
        send(liberin, new EmailConfirmMail());
    }
}
Also used : ProfileUpdatedNotification(org.moera.node.model.notification.ProfileUpdatedNotification) ProfileUpdatedEvent(org.moera.node.model.event.ProfileUpdatedEvent) EmailConfirmMail(org.moera.node.mail.EmailConfirmMail) NodeNameChangedEvent(org.moera.node.model.event.NodeNameChangedEvent) LiberinMapping(org.moera.node.liberin.LiberinMapping)

Example 19 with LiberinMapping

use of org.moera.node.liberin.LiberinMapping in project moera-node by MoeraOrg.

the class SubscriberReceptor method added.

@LiberinMapping
public void added(SubscriberAddedLiberin liberin) {
    Subscriber subscriber = liberin.getSubscriber();
    if (subscriber.getSubscriptionType() == SubscriptionType.POSTING && subscriber.getEntry() != null && !Util.toEpochSecond(subscriber.getEntry().getEditedAt()).equals(liberin.getSubscriberLastUpdatedAt())) {
        PostingUpdatedNotification notification = new PostingUpdatedNotification(subscriber.getEntry().getId());
        notification.setSubscriberId(subscriber.getId().toString());
        notification.setSubscriptionCreatedAt(Util.now());
        send(Directions.single(liberin.getNodeId(), subscriber.getRemoteNodeName()), notification);
    }
    send(liberin, new SubscriberAddedEvent(subscriber));
    sendPeopleChangedEvent(liberin);
}
Also used : Subscriber(org.moera.node.data.Subscriber) PostingUpdatedNotification(org.moera.node.model.notification.PostingUpdatedNotification) SubscriberAddedEvent(org.moera.node.model.event.SubscriberAddedEvent) LiberinMapping(org.moera.node.liberin.LiberinMapping)

Example 20 with LiberinMapping

use of org.moera.node.liberin.LiberinMapping in project moera-node by MoeraOrg.

the class SubscriptionReceptor method deleted.

@LiberinMapping
public void deleted(SubscriptionDeletedLiberin liberin) {
    send(liberin, new SubscriptionDeletedEvent(liberin.getSubscription()));
    sendPeopleChangedEvent(liberin);
}
Also used : SubscriptionDeletedEvent(org.moera.node.model.event.SubscriptionDeletedEvent) LiberinMapping(org.moera.node.liberin.LiberinMapping)

Aggregations

LiberinMapping (org.moera.node.liberin.LiberinMapping)23 Posting (org.moera.node.data.Posting)12 Comment (org.moera.node.data.Comment)5 UUID (java.util.UUID)3 Story (org.moera.node.data.Story)3 AvatarImage (org.moera.node.model.AvatarImage)3 PostingCommentsChangedEvent (org.moera.node.model.event.PostingCommentsChangedEvent)3 PostingCommentsUpdatedNotification (org.moera.node.model.notification.PostingCommentsUpdatedNotification)3 PostingUpdatedNotification (org.moera.node.model.notification.PostingUpdatedNotification)3 PostingReactionsChangedEvent (org.moera.node.model.event.PostingReactionsChangedEvent)2 PostingCommentAddedNotification (org.moera.node.model.notification.PostingCommentAddedNotification)2 PostingReactionsUpdatedNotification (org.moera.node.model.notification.PostingReactionsUpdatedNotification)2 Entry (org.moera.node.data.Entry)1 Subscriber (org.moera.node.data.Subscriber)1 EmailConfirmMail (org.moera.node.mail.EmailConfirmMail)1 CommentAddedEvent (org.moera.node.model.event.CommentAddedEvent)1 CommentDeletedEvent (org.moera.node.model.event.CommentDeletedEvent)1 CommentReactionsChangedEvent (org.moera.node.model.event.CommentReactionsChangedEvent)1 CommentUpdatedEvent (org.moera.node.model.event.CommentUpdatedEvent)1 FeedStatusUpdatedEvent (org.moera.node.model.event.FeedStatusUpdatedEvent)1