String type = request.getHttpRequest().getParam("type");
if (!type.equals("sone") && !type.equals("post") && !type.equals("reply")) {
return createErrorJsonObject("invalid-type");
}
String[] ids = request.getHttpRequest().getParam("id").split(" ");
Core core = webInterface.getCore();
for (String id : ids) {
if (type.equals("post")) {
Optional<Post> post = core.getPost(id);
if (!post.isPresent()) {
continue;
}
core.markPostKnown(post.get());
} else if (type.equals("reply")) {
Optional<PostReply> reply = core.getPostReply(id);
if (!reply.isPresent()) {
continue;
}
core.markReplyKnown(reply.get());
} else if (type.equals("sone")) {
Optional<Sone> sone = core.getSone(id);
if (!sone.isPresent()) {
continue;
}
core.markSoneKnown(sone.get());
}
}
return createSuccessJsonObject();
}