sone.getOptions().addBooleanOption("ShowNotification/NewSones", new DefaultOption<Boolean>(true));
sone.getOptions().addBooleanOption("ShowNotification/NewPosts", new DefaultOption<Boolean>(true));
sone.getOptions().addBooleanOption("ShowNotification/NewReplies", new DefaultOption<Boolean>(true));
- sone.addFriend("nwa8lHa271k2QvJ8aa0Ov7IHAV-DFOCFgmDt3X6BpCI");
+ followSone(sone, getSone("nwa8lHa271k2QvJ8aa0Ov7IHAV-DFOCFgmDt3X6BpCI"));
touchConfiguration();
return sone;
}
coreListenerManager.fireNewSoneFound(sone);
for (Sone localSone : getLocalSones()) {
if (localSone.getOptions().getBooleanOption("AutoFollow").get()) {
- localSone.addFriend(sone.getId());
- touchConfiguration();
+ followSone(localSone, sone);
}
}
}
sone.setReplies(replies);
sone.setLikePostIds(likedPostIds);
sone.setLikeReplyIds(likedReplyIds);
- sone.setFriends(friends);
+ for (String friendId : friends) {
+ followSone(sone, friendId);
+ }
sone.setAlbums(topLevelAlbums);
soneInserters.get(sone).setLastInsertFingerprint(lastInsertFingerprint);
}
}
/**
- * Sets all friends of this Sone at once.
- *
- * @param friends
- * The new (and only) friends of this Sone
- * @return This Sone (for method chaining)
- */
- public Sone setFriends(Collection<String> friends) {
- friendSones.clear();
- friendSones.addAll(friends);
- return this;
- }
-
- /**
* Returns whether this Sone has the given Sone as a friend Sone.
*
* @param friendSoneId
Sone currentSone = getCurrentSone(request.getToadletContext());
String soneIds = request.getHttpRequest().getPartAsStringFailsafe("sone", 1200);
for (String soneId : soneIds.split("[ ,]+")) {
- currentSone.addFriend(soneId);
+ if (webInterface.getCore().hasSone(soneId)) {
+ webInterface.getCore().followSone(currentSone, soneId);
+ webInterface.getCore().markSoneKnown(webInterface.getCore().getSone(soneId));
+ }
}
- webInterface.getCore().touchConfiguration();
throw new RedirectException(returnPage);
}
}
Sone currentSone = getCurrentSone(request.getToadletContext());
String soneIds = request.getHttpRequest().getPartAsStringFailsafe("sone", 2000);
for (String soneId : soneIds.split("[ ,]+")) {
- currentSone.removeFriend(soneId);
+ webInterface.getCore().unfollowSone(currentSone, soneId);
}
- webInterface.getCore().touchConfiguration();
throw new RedirectException(returnPage);
}
}
if (currentSone == null) {
return createErrorJsonObject("auth-required");
}
- currentSone.addFriend(soneId);
- webInterface.getCore().touchConfiguration();
+ webInterface.getCore().followSone(currentSone, soneId);
+ webInterface.getCore().markSoneKnown(webInterface.getCore().getSone(soneId));
return createSuccessJsonObject();
}
if (currentSone == null) {
return createErrorJsonObject("auth-required");
}
- currentSone.removeFriend(soneId);
- webInterface.getCore().touchConfiguration();
+ webInterface.getCore().unfollowSone(currentSone, soneId);
return createSuccessJsonObject();
}