summaryrefslogtreecommitdiffstats
path: root/lib/Service
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2022-10-08 14:08:55 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2022-10-08 17:29:08 +0200
commitb88e1a546a2ad8fb0cb73855f747d34778a2b1af (patch)
tree484ea8bd568e8c6c571c745affadc97a15e4a89a /lib/Service
parent64eda2fa61d96bc80fc22b9912c9cbd1ca3c733a (diff)
New administrator setting for deleting unread items automatically
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
Diffstat (limited to 'lib/Service')
-rw-r--r--lib/Service/ItemServiceV2.php14
-rw-r--r--lib/Service/UpdaterService.php2
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/Service/ItemServiceV2.php b/lib/Service/ItemServiceV2.php
index 57804a8c3..ab83ba5c5 100644
--- a/lib/Service/ItemServiceV2.php
+++ b/lib/Service/ItemServiceV2.php
@@ -145,12 +145,12 @@ class ItemServiceV2 extends Service
}
/**
- * @param int|null $threshold
- * @param bool $removeUnread
+ * @param int|null $threshold
+ * @param bool|null $purgeUnread
*
* @return int|null Amount of deleted items or null if not applicable
*/
- public function purgeOverThreshold(int $threshold = null, bool $removeUnread = false): ?int
+ public function purgeOverThreshold(int $threshold = null, bool $purgeUnread = null): ?int
{
$threshold = (int) ($threshold ?? $this->config->getAppValue(
Application::NAME,
@@ -158,11 +158,17 @@ class ItemServiceV2 extends Service
Application::DEFAULT_SETTINGS['autoPurgeCount']
));
+ $purgeUnread = (bool) ($purgeUnread ?? $this->config->getAppValue(
+ Application::NAME,
+ 'purgeUnread',
+ Application::DEFAULT_SETTINGS['purgeUnread']
+ ));
+
if ($threshold <= 0) {
return null;
}
- return $this->mapper->deleteOverThreshold($threshold, $removeUnread);
+ return $this->mapper->deleteOverThreshold($threshold, $purgeUnread);
}
/**
* Mark an item as starred
diff --git a/lib/Service/UpdaterService.php b/lib/Service/UpdaterService.php
index bf944d19f..5ab553d10 100644
--- a/lib/Service/UpdaterService.php
+++ b/lib/Service/UpdaterService.php
@@ -58,6 +58,6 @@ class UpdaterService
public function afterUpdate(): void
{
- $this->itemService->purgeOverThreshold(null);
+ $this->itemService->purgeOverThreshold();
}
}