Use “isLoaded” method to check for not-yet loaded bookmarks.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 9 Nov 2014 10:55:58 +0000 (11:55 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 22 Nov 2014 11:38:23 +0000 (12:38 +0100)
src/main/java/net/pterodactylus/sone/web/BookmarksPage.java
src/main/java/net/pterodactylus/sone/web/UnbookmarkPage.java

index 373ff18..0f53572 100644 (file)
@@ -68,7 +68,7 @@ public class BookmarksPage extends SoneTemplatePage {
 
                        @Override
                        public boolean apply(Post post) {
-                               return post.getSone() != null;
+                               return post.isLoaded();
                        }
                });
                List<Post> sortedPosts = new ArrayList<Post>(loadedPosts);
index 7dfe301..72ff2fc 100644 (file)
@@ -67,7 +67,7 @@ public class UnbookmarkPage extends SoneTemplatePage {
                if (id.equals("allNotLoaded")) {
                        Set<Post> posts = webInterface.getCore().getBookmarkedPosts();
                        for (Post post : posts) {
-                               if (post.getSone() == null) {
+                               if (post.isLoaded()) {
                                        webInterface.getCore().unbookmarkPost(post);
                                }
                        }