projects
/
Sone.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d7ddf7e
)
Don’t set friends directly, use Core’s follow() methods.
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Sun, 13 Nov 2011 18:51:50 +0000
(19:51 +0100)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Sun, 13 Nov 2011 18:51:50 +0000
(19:51 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/data/Sone.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/FollowSonePage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java
patch
|
blob
|
history
diff --git
a/src/main/java/net/pterodactylus/sone/core/Core.java
b/src/main/java/net/pterodactylus/sone/core/Core.java
index
b42fc34
..
2112e18
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/Core.java
+++ b/
src/main/java/net/pterodactylus/sone/core/Core.java
@@
-1032,7
+1032,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
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.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;
}
touchConfiguration();
return sone;
}
@@
-1065,8
+1065,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
coreListenerManager.fireNewSoneFound(sone);
for (Sone localSone : getLocalSones()) {
if (localSone.getOptions().getBooleanOption("AutoFollow").get()) {
coreListenerManager.fireNewSoneFound(sone);
for (Sone localSone : getLocalSones()) {
if (localSone.getOptions().getBooleanOption("AutoFollow").get()) {
- localSone.addFriend(sone.getId());
- touchConfiguration();
+ followSone(localSone, sone);
}
}
}
}
}
}
@@
-1628,7
+1627,9
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
sone.setReplies(replies);
sone.setLikePostIds(likedPostIds);
sone.setLikeReplyIds(likedReplyIds);
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);
}
sone.setAlbums(topLevelAlbums);
soneInserters.get(sone).setLastInsertFingerprint(lastInsertFingerprint);
}
diff --git
a/src/main/java/net/pterodactylus/sone/data/Sone.java
b/src/main/java/net/pterodactylus/sone/data/Sone.java
index
ca970c2
..
006765a
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/data/Sone.java
+++ b/
src/main/java/net/pterodactylus/sone/data/Sone.java
@@
-380,19
+380,6
@@
public class Sone implements Fingerprintable, Comparable<Sone> {
}
/**
}
/**
- * 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
* Returns whether this Sone has the given Sone as a friend Sone.
*
* @param friendSoneId
diff --git
a/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java
b/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java
index
143e0ba
..
4083b99
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/FollowSonePage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/FollowSonePage.java
@@
-55,9
+55,11
@@
public class FollowSonePage extends SoneTemplatePage {
Sone currentSone = getCurrentSone(request.getToadletContext());
String soneIds = request.getHttpRequest().getPartAsStringFailsafe("sone", 1200);
for (String soneId : soneIds.split("[ ,]+")) {
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);
}
}
throw new RedirectException(returnPage);
}
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java
b/src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java
index
d8e53ce
..
f07880d
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java
@@
-55,9
+55,8
@@
public class UnfollowSonePage extends SoneTemplatePage {
Sone currentSone = getCurrentSone(request.getToadletContext());
String soneIds = request.getHttpRequest().getPartAsStringFailsafe("sone", 2000);
for (String soneId : soneIds.split("[ ,]+")) {
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);
}
}
throw new RedirectException(returnPage);
}
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java
index
5c3e5f4
..
764fa28
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java
@@
-52,8
+52,8
@@
public class FollowSoneAjaxPage extends JsonPage {
if (currentSone == null) {
return createErrorJsonObject("auth-required");
}
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();
}
return createSuccessJsonObject();
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java
index
26f1a11
..
5d94d52
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.java
@@
-52,8
+52,7
@@
public class UnfollowSoneAjaxPage extends JsonPage {
if (currentSone == null) {
return createErrorJsonObject("auth-required");
}
if (currentSone == null) {
return createErrorJsonObject("auth-required");
}
- currentSone.removeFriend(soneId);
- webInterface.getCore().touchConfiguration();
+ webInterface.getCore().unfollowSone(currentSone, soneId);
return createSuccessJsonObject();
}
return createSuccessJsonObject();
}