import java.util.List;
import java.util.Set;
+import net.pterodactylus.sone.data.LocalSone;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.PostReply;
import net.pterodactylus.sone.data.Sone;
*/
@Override
protected JsonReturnObject createJsonObject(FreenetRequest request) {
- final Optional<Sone> currentSone = getCurrentSone(request.getToadletContext(), false);
+ final Optional<LocalSone> currentSone = getCurrentSone(request.getToadletContext(), false);
/* load Sones. always return the status of the current Sone. */
Set<Sone> sones = new HashSet<Sone>(currentSone.asSet());
String loadSoneIds = request.getHttpRequest().getParam("soneIds");
jsonSone.put("name", SoneAccessor.getNiceName(sone));
jsonSone.put("local", sone.getInsertUri() != null);
jsonSone.put("status", sone.getStatus().name());
- jsonSone.put("modified", webInterface.getCore().isModifiedSone(sone));
- jsonSone.put("locked", webInterface.getCore().isLocked(sone));
+ jsonSone.put("modified", sone.isLocal() ? webInterface.getCore().isModifiedSone((LocalSone) sone) : false);
+ jsonSone.put("locked", sone.isLocal() ? webInterface.getCore().isLocked((LocalSone) sone) : false);
jsonSone.put("lastUpdatedUnknown", sone.getTime() == 0);
synchronized (dateFormat) {
jsonSone.put("lastUpdated", dateFormat.format(new Date(sone.getTime())));
* The current Sone (may be {@code null})
* @return The current options
*/
- private static JsonNode createJsonOptions(Optional<Sone> currentSone) {
+ private static JsonNode createJsonOptions(Optional<LocalSone> currentSone) {
ObjectNode options = new ObjectNode(instance);
if (currentSone.isPresent()) {
options.put("ShowNotification/NewSones", currentSone.get().getOptions().isShowNewSoneNotifications());