/*
- * Sone - MarkAsKnownAjaxPage.java - Copyright © 2011–2013 David Roden
+ * Sone - MarkAsKnownAjaxPage.java - Copyright © 2011–2016 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
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 com.google.common.base.Optional;
* {@inheritDoc}
*/
@Override
- protected JsonObject createJsonObject(FreenetRequest request) {
+ protected JsonReturnObject createJsonObject(FreenetRequest request) {
String type = request.getHttpRequest().getParam("type");
if (!type.equals("sone") && !type.equals("post") && !type.equals("reply")) {
return createErrorJsonObject("invalid-type");
}
core.markReplyKnown(reply.get());
} else if (type.equals("sone")) {
- Sone sone = core.getSone(id);
- if (sone == null) {
+ Optional<Sone> sone = core.getSone(id);
+ if (!sone.isPresent()) {
continue;
}
- core.markSoneKnown(sone);
+ core.markSoneKnown(sone.get());
}
}
return createSuccessJsonObject();