X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetSoneStatusPage.java;h=47d377a3eff8bf00f971d511ca7cbbc2d8bd6a8b;hb=728eb9dfab6b9284dbb69701fa8ba4a9b072e7ca;hp=740d143046bc17faf87240c63a789c9bc1fe5c8e;hpb=8c8b13f370554e861ec755afc9e157ea048adc07;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java index 740d143..47d377a 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java @@ -20,6 +20,7 @@ package net.pterodactylus.sone.web.ajax; import java.text.SimpleDateFormat; import java.util.Date; +import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.core.Core.SoneStatus; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.template.SoneAccessor; @@ -28,7 +29,7 @@ import net.pterodactylus.util.json.JsonObject; /** * AJAX page that reeturns the status of a sone, as a) a {@link SoneStatus} name - * and b) a “modified” boolean (as per {@link Sone#getModificationCounter()}). + * and b) a “modified” boolean (as per {@link Core#isModifiedSone(Sone)}). * * @author David ‘Bombe’ Roden */ @@ -54,9 +55,9 @@ public class GetSoneStatusPage extends JsonPage { @Override protected JsonObject createJsonObject(Request request) { String soneId = request.getHttpRequest().getParam("sone"); - Sone sone = webInterface.core().getSone(soneId); - SoneStatus soneStatus = webInterface.core().getSoneStatus(sone); - return new JsonObject().put("status", soneStatus.name()).put("name", SoneAccessor.getNiceName(sone)).put("modified", sone.getModificationCounter() > 0).put("lastUpdated", new SimpleDateFormat("MMM d, yyyy, HH:mm:ss").format(new Date(sone.getTime()))).put("age", (System.currentTimeMillis() - sone.getTime()) / 1000); + Sone sone = webInterface.getCore().getSone(soneId); + SoneStatus soneStatus = webInterface.getCore().getSoneStatus(sone); + return createSuccessJsonObject().put("status", soneStatus.name()).put("name", SoneAccessor.getNiceName(sone)).put("modified", webInterface.getCore().isModifiedSone(sone)).put("locked", webInterface.getCore().isLocked(sone)).put("lastUpdated", new SimpleDateFormat("MMM d, yyyy, HH:mm:ss").format(new Date(sone.getTime()))).put("age", (System.currentTimeMillis() - sone.getTime()) / 1000); } /**