projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'release-0.8.5'
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
web
/
ajax
/
MarkAsKnownAjaxPage.java
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
index
370bacd
..
6610971
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java
@@
-1,5
+1,5
@@
/*
/*
- * Sone - MarkAsKnownAjaxPage.java - Copyright © 2011–201
2
David Roden
+ * Sone - MarkAsKnownAjaxPage.java - Copyright © 2011–201
3
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
@@
-26,6
+26,8
@@
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.sone.web.page.FreenetRequest;
import net.pterodactylus.util.json.JsonObject;
import net.pterodactylus.sone.web.page.FreenetRequest;
import net.pterodactylus.util.json.JsonObject;
+import com.google.common.base.Optional;
+
/**
* AJAX page that lets the user mark a number of {@link Sone}s, {@link Post}s,
* or {@link Reply}s as known.
/**
* AJAX page that lets the user mark a number of {@link Sone}s, {@link Post}s,
* or {@link Reply}s as known.
@@
-57,23
+59,23
@@
public class MarkAsKnownAjaxPage extends JsonPage {
Core core = webInterface.getCore();
for (String id : ids) {
if (type.equals("post")) {
Core core = webInterface.getCore();
for (String id : ids) {
if (type.equals("post")) {
-
Post post = core.getPost(id, false
);
- if (
post == null
) {
+
Optional<Post> post = core.getPost(id
);
+ if (
!post.isPresent()
) {
continue;
}
continue;
}
- core.markPostKnown(post);
+ core.markPostKnown(post
.get()
);
} else if (type.equals("reply")) {
} else if (type.equals("reply")) {
-
PostReply reply = core.getReply(id, false
);
- if (
reply == null
) {
+
Optional<PostReply> reply = core.getPostReply(id
);
+ if (
!reply.isPresent()
) {
continue;
}
continue;
}
- core.markReplyKnown(reply);
+ core.markReplyKnown(reply
.get()
);
} else if (type.equals("sone")) {
} else if (type.equals("sone")) {
-
Sone sone = core.getSone(id, false
);
- if (
sone == null
) {
+
Optional<Sone> sone = core.getSone(id
);
+ if (
!sone.isPresent()
) {
continue;
}
continue;
}
- core.markSoneKnown(sone);
+ core.markSoneKnown(sone
.get()
);
}
}
return createSuccessJsonObject();
}
}
return createSuccessJsonObject();