Use local Sone when checking for modifications.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 3 Dec 2014 05:30:44 +0000 (06:30 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 3 Dec 2014 05:30:44 +0000 (06:30 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java
src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java

index 2d23de3..0680d30 100644 (file)
@@ -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();
        }
 
index 6c5ca06..786b375 100644 (file)
@@ -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")) {
index c269627..dcf443a 100644 (file)
@@ -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) {