Use already existing variable for current Sone
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / GetStatusAjaxPage.java
index 7a4c391..45c1cee 100644 (file)
@@ -74,9 +74,9 @@ public class GetStatusAjaxPage extends JsonPage {
         */
        @Override
        protected JsonReturnObject createJsonObject(FreenetRequest request) {
-               final Sone currentSone = getCurrentSone(request.getToadletContext(), false);
+               final Sone currentSone = getCurrentSoneWithoutCreatingSession(request.getToadletContext());
                /* load Sones. always return the status of the current Sone. */
-               Set<Sone> sones = new HashSet<Sone>(Collections.singleton(getCurrentSone(request.getToadletContext(), false)));
+               Set<Sone> sones = new HashSet<Sone>(Collections.singleton(currentSone));
                String loadSoneIds = request.getHttpRequest().getParam("soneIds");
                if (loadSoneIds.length() > 0) {
                        String[] soneIds = loadSoneIds.split(",");
@@ -96,7 +96,7 @@ public class GetStatusAjaxPage extends JsonPage {
                List<Notification> notifications = new ArrayList<Notification>(webInterface.getNotifications(currentSone));
                Collections.sort(notifications, Notification.CREATED_TIME_SORTER);
                /* load new posts. */
-               Collection<Post> newPosts = webInterface.getNewPosts(getCurrentSone(request.getToadletContext(), false));
+               Collection<Post> newPosts = webInterface.getNewPosts(currentSone);
 
                ArrayNode jsonPosts = new ArrayNode(instance);
                for (Post post : newPosts) {
@@ -108,7 +108,7 @@ public class GetStatusAjaxPage extends JsonPage {
                        jsonPosts.add(jsonPost);
                }
                /* load new replies. */
-               Collection<PostReply> newReplies = webInterface.getNewReplies(getCurrentSone(request.getToadletContext(), false));
+               Collection<PostReply> newReplies = webInterface.getNewReplies(currentSone);
 
                ArrayNode jsonReplies = new ArrayNode(instance);
                for (PostReply reply : newReplies) {
@@ -153,7 +153,7 @@ public class GetStatusAjaxPage extends JsonPage {
                ObjectNode jsonSone = new ObjectNode(instance);
                jsonSone.put("id", sone.getId());
                jsonSone.put("name", SoneAccessor.getNiceName(sone));
-               jsonSone.put("local", sone.getInsertUri() != null);
+               jsonSone.put("local", sone.isLocal());
                jsonSone.put("status", sone.getStatus().name());
                jsonSone.put("modified", webInterface.getCore().isModifiedSone(sone));
                jsonSone.put("locked", webInterface.getCore().isLocked(sone));