diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2021-01-14 11:37:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-14 11:37:38 +0100 |
commit | 6265383385b014752b4ad8a6df9f45e3eecda7f9 (patch) | |
tree | 6d6966d8741ffd45abd793de92ead3151ccb3199 /apps/dav/lib/CalDAV | |
parent | f9ab7575e70aeb5a08cba8fca9661dd6e4704cc9 (diff) | |
parent | 536e157d744a60d2e66acb3ec79ecdc53ec3fb5a (diff) | |
download | nextcloud-server-6265383385b014752b4ad8a6df9f45e3eecda7f9.tar.gz nextcloud-server-6265383385b014752b4ad8a6df9f45e3eecda7f9.zip |
Merge pull request #25114 from nextcloud/dismiss-reminder-notifications-from-passed-events
Dismiss reminder notifications from passed events
Diffstat (limited to 'apps/dav/lib/CalDAV')
-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); |