diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2022-06-06 09:40:02 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2022-06-06 09:41:52 +0200 |
commit | ef313f51eedac844078157b24da3fcce059ccf11 (patch) | |
tree | c4f376ba6f722ce0069ecb9302e281efa680bf41 | |
parent | f435e6610289cd298c9e5e5c22f30479a3ef646a (diff) |
KB66 NewsletterSender: Only consider top-level posts.
Change-Id: I8a57dbdbad27e01297263b382ce557859d9b462d
-rw-r--r-- | src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java | 14 |
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); |