From ca4d7942f23d67f538b470b93a9dd0ffecee5f00 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 18 Apr 2020 14:13:41 +0200 Subject: KB46 Post#queryViewable: Fix visible posts query logic for Post.class. Change-Id: Ic7f16a9dec8e639133ab266540b5f25d8f1594c9 --- src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java b/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java index 356461c..654db5f 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java @@ -126,12 +126,14 @@ public abstract class Post extends PanacheEntityBase { var root = query.from(User.class); conditions.add(cb.equal(root, user)); - if (entityClass.isAssignableFrom(Bookmark.class)) { + if (entityClass.isAssignableFrom(Post.class)) { + post = (From) root.join(User_.visiblePosts); + } else if (entityClass.isAssignableFrom(Bookmark.class)) { post = (From) root.join(User_.visibleBookmarks); } else if (entityClass.isAssignableFrom(LazychatMessage.class)) { post = (From) root.join(User_.visibleLazychatMessages); } else { - post = (From) root.join(User_.visiblePosts); + throw new IllegalArgumentException(); } } -- cgit v1.2.3