summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2022-06-06 09:40:02 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2022-06-06 09:41:52 +0200
commitef313f51eedac844078157b24da3fcce059ccf11 (patch)
treec4f376ba6f722ce0069ecb9302e281efa680bf41 /src/main/java
parentf435e6610289cd298c9e5e5c22f30479a3ef646a (diff)
KB66 NewsletterSender: Only consider top-level posts.
Change-Id: I8a57dbdbad27e01297263b382ce557859d9b462d
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java
index c6999fb..b8f2d07 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java
@@ -55,12 +55,14 @@ public class NewsletterSender {
List<Post<?>> posts =
Post.list(
- ""
- + "SELECT p FROM Post p"
- + " JOIN p.targets r"
- + " JOIN r.tags tag"
- + " WHERE newsletter IS NULL"
- + " AND tag = 'world'",
+ """
+ SELECT DISTINCT p FROM Post p
+ JOIN p.targets r
+ JOIN r.tags tag
+ WHERE p.newsletter IS NULL
+ AND p.scope = 'top_level'
+ AND tag = 'world'
+ """,
Sort.ascending("date"));
Post.fetchTexts(posts);