summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2020-04-18 14:13:41 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2020-04-18 14:13:41 +0200
commitca4d7942f23d67f538b470b93a9dd0ffecee5f00 (patch)
treec55b3b1b2d53a5424344a8069436d17cd503f26a /src/main
parent5794b9062d1dd94415757c2236bdfc766921f97f (diff)
KB46 Post#queryViewable: Fix visible posts query logic for Post.class.
Change-Id: Ic7f16a9dec8e639133ab266540b5f25d8f1594c9
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java6
1 files changed, 4 insertions, 2 deletions
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<?, T>) root.join(User_.visiblePosts);
+ } else if (entityClass.isAssignableFrom(Bookmark.class)) {
post = (From<?, T>) root.join(User_.visibleBookmarks);
} else if (entityClass.isAssignableFrom(LazychatMessage.class)) {
post = (From<?, T>) root.join(User_.visibleLazychatMessages);
} else {
- post = (From<?, T>) root.join(User_.visiblePosts);
+ throw new IllegalArgumentException();
}
}