projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove useless line.
[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
..
1269b41
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.java
@@
-35,7
+35,7
@@
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);
}
/**
}
/**
@@
-44,17
+44,16
@@
public class FollowSoneAjaxPage extends JsonPage {
@Override
protected JsonObject createJsonObject(Request request) {
String soneId = request.getHttpRequest().getParam("sone");
@Override
protected JsonObject createJsonObject(Request request) {
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.
c
ore().saveSone(currentSone);
- return
new JsonObject().put("success", true
);
+ currentSone.addFriend(sone
Id
);
+ webInterface.
getC
ore().saveSone(currentSone);
+ return
createSuccessJsonObject(
);
}
}
}
}