Use “isLoaded” method to check whether a post is loaded.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 9 Nov 2014 15:01:11 +0000 (16:01 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 22 Nov 2014 11:38:42 +0000 (12:38 +0100)
src/main/java/net/pterodactylus/sone/notify/ListNotificationFilters.java
src/main/java/net/pterodactylus/sone/template/PostAccessor.java

index 5289081..f93e1f4 100644 (file)
@@ -222,10 +222,10 @@ public class ListNotificationFilters {
         */
        public static boolean isPostVisible(Sone sone, Post post) {
                checkNotNull(post, "post must not be null");
-               Sone postSone = post.getSone();
-               if (postSone == null) {
+               if (!post.isLoaded()) {
                        return false;
                }
+               Sone postSone = post.getSone();
                if (sone != null) {
                        Trust trust = postSone.getIdentity().getTrust((OwnIdentity) sone.getIdentity());
                        if (trust != null) {
index d593b51..78db678 100644 (file)
@@ -67,8 +67,6 @@ public class PostAccessor extends ReflectionAccessor {
                        return !post.isKnown();
                } else if (member.equals("bookmarked")) {
                        return core.isBookmarked(post);
-               } else if (member.equals("loaded")) {
-                       return post.getSone() != null;
                }
                return super.get(templateContext, object, member);
        }