projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use database methods where possible.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
web
/
FollowSonePage.java
diff --git
a/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java
b/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java
index
143e0ba
..
11a680c
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/FollowSonePage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/FollowSonePage.java
@@
-1,5
+1,5
@@
/*
/*
- * Sone - FollowSonePage.java - Copyright © 2010 David Roden
+ * Sone - FollowSonePage.java - Copyright © 2010
–2013
David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-17,6
+17,8
@@
package net.pterodactylus.sone.web;
package net.pterodactylus.sone.web;
+import com.google.common.base.Optional;
+
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.web.page.FreenetRequest;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.web.page.FreenetRequest;
import net.pterodactylus.util.template.Template;
@@
-55,9
+57,12
@@
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);
+ Optional<Sone> sone = webInterface.getCore().getSone(soneId);
+ if (sone.isPresent()) {
+ webInterface.getCore().followSone(currentSone, soneId);
+ webInterface.getCore().markSoneKnown(sone.get());
+ }
}
}
- webInterface.getCore().touchConfiguration();
throw new RedirectException(returnPage);
}
}
throw new RedirectException(returnPage);
}
}