summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-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);