projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Filter links from image and album descriptions.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
web
/
ajax
/
FollowSoneAjaxPage.java
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
7dc1b24
..
5c3e5f4
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java
@@
-19,6
+19,7
@@
package net.pterodactylus.sone.web.ajax;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.web.WebInterface;
+import net.pterodactylus.sone.web.page.FreenetRequest;
import net.pterodactylus.util.json.JsonObject;
/**
import net.pterodactylus.util.json.JsonObject;
/**
@@
-35,26
+36,25
@@
public class FollowSoneAjaxPage extends JsonPage {
* The Sone web interface
*/
public FollowSoneAjaxPage(WebInterface webInterface) {
* The Sone web interface
*/
public FollowSoneAjaxPage(WebInterface webInterface) {
- super("
ajax/
followSone.ajax", webInterface);
+ super("followSone.ajax", webInterface);
}
/**
* {@inheritDoc}
*/
@Override
}
/**
* {@inheritDoc}
*/
@Override
- protected JsonObject createJsonObject(Request request) {
+ protected JsonObject createJsonObject(
Freenet
Request request) {
String soneId = request.getHttpRequest().getParam("sone");
String soneId = request.getHttpRequest().getParam("sone");
- Sone sone = webInterface.core().getSone(soneId);
- if (sone == null) {
- return new JsonObject().put("success", false).put("error", "invalid-sone-id");
+ if (!webInterface.getCore().hasSone(soneId)) {
+ return createErrorJsonObject("invalid-sone-id");
}
Sone currentSone = getCurrentSone(request.getToadletContext());
if (currentSone == null) {
}
Sone currentSone = getCurrentSone(request.getToadletContext());
if (currentSone == null) {
- return
new JsonObject().put("success", false).put("error",
"auth-required");
+ return
createErrorJsonObject(
"auth-required");
}
}
- currentSone.addFriend(sone);
- webInterface.
core().saveSone(currentSone
);
- return
new JsonObject().put("success", true
);
+ currentSone.addFriend(sone
Id
);
+ webInterface.
getCore().touchConfiguration(
);
+ return
createSuccessJsonObject(
);
}
}
}
}