}
for (PostReply postReply : soneComparison.getNewPostReplies()) {
if (postReply.getSone().equals(newSone)) {
- postReply.setKnown(true);
+ database.setPostReplyKnown(postReply);
} else if (postReply.getTime() < database.getFollowingTime(newSone.getId())) {
- postReply.setKnown(true);
+ database.setPostReplyKnown(postReply);
} else if (!postReply.isKnown()) {
events.add(new NewPostReplyFoundEvent(postReply));
}
post.setKnown(true);
}
for (PostReply reply : replies) {
- reply.setKnown(true);
+ database.setPostReplyKnown(reply);
}
logger.info(String.format("Sone loaded successfully: %s", sone));
*/
public void markReplyKnown(PostReply reply) {
boolean previouslyKnown = reply.isKnown();
- reply.setKnown(true);
+ database.setPostReplyKnown(reply);
eventBus.post(new MarkPostReplyKnownEvent(reply));
if (!previouslyKnown) {
touchConfiguration();
OwnIdentity ownIdentity = identityRemovedEvent.getOwnIdentity();
Identity identity = identityRemovedEvent.getIdentity();
trustedIdentities.remove(ownIdentity, identity);
- for (Entry<OwnIdentity, Collection<Identity>> trustedIdentity : trustedIdentities.asMap().entrySet()) {
- if (trustedIdentity.getKey().equals(ownIdentity)) {
- continue;
- }
- if (trustedIdentity.getValue().contains(identity)) {
- return;
- }
+ if (otherOwnIdentityStillKnowsIdentity(ownIdentity, identity)) {
+ return;
}
Sone sone = getSone(identity.getId());
if (sone == null) {
database.removeSone(sone);
}
+ private boolean otherOwnIdentityStillKnowsIdentity(OwnIdentity ownIdentity, Identity identity) {
+ return trustedIdentities.entries().stream().anyMatch(e -> !e.getKey().equals(ownIdentity) && e.getValue().equals(identity));
+ }
+
/**
* Deletes the temporary image.
*