diff options
author | Thomas Citharel <tcit@tcit.fr> | 2021-01-13 19:59:29 +0100 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2021-01-14 10:42:47 +0100 |
commit | 536e157d744a60d2e66acb3ec79ecdc53ec3fb5a (patch) | |
tree | 67d9cfda04ba5504c5543dc7965fc43fa09af5de /apps/dav/lib | |
parent | 97743df3fcd6243f9b2755a4c86586b61a96e793 (diff) | |
download | nextcloud-server-536e157d744a60d2e66acb3ec79ecdc53ec3fb5a.tar.gz nextcloud-server-536e157d744a60d2e66acb3ec79ecdc53ec3fb5a.zip |
Dismiss reminder notifications from passed events
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/CalDAV/Reminder/Notifier.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/Reminder/Notifier.php b/apps/dav/lib/CalDAV/Reminder/Notifier.php index 7618222f42a..310f5e5b23d 100644 --- a/apps/dav/lib/CalDAV/Reminder/Notifier.php +++ b/apps/dav/lib/CalDAV/Reminder/Notifier.php @@ -36,6 +36,7 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\IL10N; use OCP\IURLGenerator; use OCP\L10N\IFactory; +use OCP\Notification\AlreadyProcessedException; use OCP\Notification\INotification; use OCP\Notification\INotifier; @@ -223,6 +224,12 @@ class Notifier implements INotifier { private function generateDateString(array $parameters):string { $startDateTime = DateTime::createFromFormat(\DateTime::ATOM, $parameters['start_atom']); $endDateTime = DateTime::createFromFormat(\DateTime::ATOM, $parameters['end_atom']); + + // If the event has already ended, dismiss the notification + if ($endDateTime < $this->timeFactory->getDateTime()) { + throw new AlreadyProcessedException(); + } + $isAllDay = $parameters['all_day']; $diff = $startDateTime->diff($endDateTime); |