use of org.moera.node.model.AvatarImage in project moera-node by MoeraOrg.
the class CommentInstants method addingFailed.
public void addingFailed(String postingId, PostingInfo postingInfo) {
String postingOwnerName = postingInfo != null ? postingInfo.getOwnerName() : "";
String postingOwnerFullName = postingInfo != null ? postingInfo.getOwnerFullName() : null;
AvatarImage postingOwnerAvatar = postingInfo != null ? postingInfo.getOwnerAvatar() : null;
String postingHeading = postingInfo != null ? postingInfo.getHeading() : "";
Story story = new Story(UUID.randomUUID(), nodeId(), StoryType.COMMENT_POST_TASK_FAILED);
story.setFeedName(Feed.INSTANT);
story.setRemoteNodeName(postingOwnerName);
story.setRemoteFullName(postingOwnerFullName);
if (postingOwnerAvatar != null) {
story.setRemoteOwnerAvatarMediaFile(postingOwnerAvatar.getMediaFile());
story.setRemoteOwnerAvatarShape(postingOwnerAvatar.getShape());
}
story.setRemotePostingId(postingId);
story.setSummary(buildAddingFailedSummary(postingOwnerName, postingOwnerFullName, postingHeading));
story.setPublishedAt(Util.now());
updateMoment(story);
story = storyRepository.save(story);
send(new StoryAddedEvent(story, true));
sendPush(story);
feedStatusUpdated();
}
use of org.moera.node.model.AvatarImage in project moera-node by MoeraOrg.
the class CommentReactionInstants method addingFailed.
public void addingFailed(String postingId, PostingInfo postingInfo, String commentId, CommentInfo commentInfo) {
String postingOwnerName = postingInfo != null ? postingInfo.getOwnerName() : "";
String postingOwnerFullName = postingInfo != null ? postingInfo.getOwnerFullName() : null;
AvatarImage postingOwnerAvatar = postingInfo != null ? postingInfo.getOwnerAvatar() : null;
String postingHeading = postingInfo != null ? postingInfo.getHeading() : "";
String commentOwnerName = commentInfo != null ? commentInfo.getOwnerName() : "";
String commentOwnerFullName = commentInfo != null ? commentInfo.getOwnerFullName() : null;
AvatarImage commentOwnerAvatar = commentInfo != null ? commentInfo.getOwnerAvatar() : null;
String commentHeading = commentInfo != null ? commentInfo.getHeading() : "";
Story story = new Story(UUID.randomUUID(), nodeId(), StoryType.COMMENT_REACTION_TASK_FAILED);
story.setFeedName(Feed.INSTANT);
story.setRemoteNodeName(postingOwnerName);
story.setRemoteFullName(postingOwnerFullName);
if (postingOwnerAvatar != null) {
story.setRemoteAvatarMediaFile(postingOwnerAvatar.getMediaFile());
story.setRemoteAvatarShape(postingOwnerAvatar.getShape());
}
story.setRemotePostingId(postingId);
story.setRemoteOwnerName(commentOwnerName);
story.setRemoteOwnerFullName(commentOwnerFullName);
if (commentOwnerAvatar != null) {
story.setRemoteOwnerAvatarMediaFile(commentOwnerAvatar.getMediaFile());
story.setRemoteOwnerAvatarShape(commentOwnerAvatar.getShape());
}
story.setRemoteCommentId(commentId);
story.setSummary(buildAddingFailedSummary(postingOwnerName, postingOwnerFullName, postingHeading, commentOwnerName, commentOwnerFullName, commentHeading));
story.setPublishedAt(Util.now());
updateMoment(story);
story = storyRepository.save(story);
send(new StoryAddedEvent(story, true));
sendPush(story);
feedStatusUpdated();
}
use of org.moera.node.model.AvatarImage in project moera-node by MoeraOrg.
the class PostingReactionReceptor method updated.
private void updated(Liberin liberin, Posting posting, Reaction addedReaction, Reaction deletedReaction, ReactionTotalsInfo reactionTotals) {
if (addedReaction != null && addedReaction.getSignature() != null) {
AvatarImage ownerAvatar = new AvatarImage(addedReaction.getOwnerAvatarMediaFile(), addedReaction.getOwnerAvatarShape());
if (posting.getParentMedia() == null) {
send(Directions.single(liberin.getNodeId(), posting.getOwnerName()), new PostingReactionAddedNotification(null, null, null, null, posting.getId(), posting.getCurrentRevision().getHeading(), addedReaction.getOwnerName(), addedReaction.getOwnerFullName(), ownerAvatar, addedReaction.isNegative(), addedReaction.getEmoji()));
} else {
Set<Entry> entries = entryRepository.findByMediaId(posting.getParentMedia().getId());
for (Entry entry : entries) {
UUID parentPostingId = entry instanceof Comment ? ((Comment) entry).getPosting().getId() : entry.getId();
UUID parentCommentId = entry instanceof Comment ? entry.getId() : null;
send(Directions.single(liberin.getNodeId(), posting.getOwnerName()), new PostingReactionAddedNotification(parentPostingId, parentCommentId, posting.getParentMedia().getId(), entry.getCurrentRevision().getHeading(), posting.getId(), posting.getCurrentRevision().getHeading(), addedReaction.getOwnerName(), addedReaction.getOwnerFullName(), ownerAvatar, addedReaction.isNegative(), addedReaction.getEmoji()));
}
}
}
if (deletedReaction != null) {
AvatarImage ownerAvatar = new AvatarImage(deletedReaction.getOwnerAvatarMediaFile(), deletedReaction.getOwnerAvatarShape());
if (posting.getParentMedia() == null) {
send(Directions.single(liberin.getNodeId(), posting.getOwnerName()), new PostingReactionDeletedNotification(null, null, null, posting.getId(), deletedReaction.getOwnerName(), deletedReaction.getOwnerFullName(), ownerAvatar, deletedReaction.isNegative()));
} else {
Set<Entry> entries = entryRepository.findByMediaId(posting.getParentMedia().getId());
for (Entry entry : entries) {
UUID parentPostingId = entry instanceof Comment ? ((Comment) entry).getPosting().getId() : entry.getId();
UUID parentCommentId = entry instanceof Comment ? entry.getId() : null;
send(Directions.single(liberin.getNodeId(), posting.getOwnerName()), new PostingReactionDeletedNotification(parentPostingId, parentCommentId, posting.getParentMedia().getId(), posting.getId(), deletedReaction.getOwnerName(), deletedReaction.getOwnerFullName(), ownerAvatar, deletedReaction.isNegative()));
}
}
}
send(liberin, new PostingReactionsChangedEvent(posting));
send(Directions.postingSubscribers(posting.getNodeId(), posting.getId()), new PostingReactionsUpdatedNotification(posting.getId(), reactionTotals));
}
use of org.moera.node.model.AvatarImage 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()));
}
use of org.moera.node.model.AvatarImage in project moera-node by MoeraOrg.
the class CommentReceptor method updated.
@LiberinMapping
public void updated(CommentUpdatedLiberin liberin) {
Comment comment = liberin.getComment();
Posting posting = comment.getPosting();
notifyReplyAdded(posting, comment);
notifyMentioned(posting, comment.getId(), comment.getOwnerName(), comment.getOwnerFullName(), new AvatarImage(comment.getOwnerAvatarMediaFile(), comment.getOwnerAvatarShape()), comment.getCurrentRevision(), liberin.getLatestRevision());
if (comment.getCurrentRevision().getSignature() != null) {
UUID repliedToId = comment.getRepliedTo() != null ? comment.getRepliedTo().getId() : null;
send(Directions.postingCommentsSubscribers(comment.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));
}
send(liberin, new CommentUpdatedEvent(comment));
}
Aggregations