summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java10
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSubscriptionExpirer.java3
2 files changed, 10 insertions, 3 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 59ab37c..7a52d32 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSender.java
@@ -50,7 +50,15 @@ public class NewsletterSender {
void run() throws InterruptedException, TimeoutException, ExecutionException {
var session = em.unwrap(Session.class);
- List<Post<?>> posts = Post.list("newsletter IS NULL", Sort.ascending("date"));
+ 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'",
+ Sort.ascending("date"));
Post.fetchTexts(posts);
if (posts.isEmpty()) {
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSubscriptionExpirer.java b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSubscriptionExpirer.java
index 43787dc..a9dda9c 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSubscriptionExpirer.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterSubscriptionExpirer.java
@@ -16,8 +16,7 @@ public class NewsletterSubscriptionExpirer {
void run() {
var subscriptionsDeleted =
NewsletterSubscription.delete(
- "registrationKey IS NOT NULL AND startDate < ?1",
- OffsetDateTime.now().minusWeeks(1));
+ "registrationKey IS NOT NULL AND startDate < ?1", OffsetDateTime.now().minusWeeks(1));
if (subscriptionsDeleted > 0) {
log.infof("%d expired newsletter subscriptions deleted.", subscriptionsDeleted);
}