From: David ‘Bombe’ Roden Date: Wed, 3 Dec 2014 05:30:44 +0000 (+0100) Subject: Use local Sone when checking for modifications. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=535ff37f006c1dd058590667e3b895ebc66af04a;p=Sone.git Use local Sone when checking for modifications. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 2d23de3..0680d30 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -363,7 +363,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, * @return {@code true} if a modification has been detected in the Sone, * {@code false} otherwise */ - public boolean isModifiedSone(Sone sone) { + public boolean isModifiedSone(LocalSone sone) { return soneInserters.containsKey(sone) && soneInserters.get(sone).isModified(); } diff --git a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java index 6c5ca06..786b375 100644 --- a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java +++ b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java @@ -89,7 +89,7 @@ public class SoneAccessor extends ReflectionAccessor { Sone currentSone = (Sone) templateContext.get("currentSone"); return (currentSone != null) && currentSone.equals(sone); } else if (member.equals("modified")) { - return core.isModifiedSone(sone); + return sone.isLocal() ? core.isModifiedSone((LocalSone) sone) : false; } else if (member.equals("status")) { return sone.getStatus(); } else if (member.equals("unknown")) { diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java index c269627..dcf443a 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java @@ -173,7 +173,7 @@ public class GetStatusAjaxPage extends JsonPage { 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("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) {