Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/event_update_notification.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-07-06 22:04:40 +0300
committerJoas Schilling <coding@schilljs.com>2021-07-06 22:04:40 +0300
commit6097d3a2c43392a65b0ba0c0a2cb03d8116c1d77 (patch)
treeed79fbb6d4cc5c3f281e2093dcfc00cfb48399ce
parent39f41e563e3e6406d345184b76f25222e08798e0 (diff)
Add calendar trashbin supportv1.3.0
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--CHANGELOG.md4
-rw-r--r--appinfo/info.xml4
-rw-r--r--lib/AppInfo/Application.php2
-rw-r--r--lib/EventListener.php15
4 files changed, 19 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a276629..d589774 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.
+## 1.3.0 – 2021-07-06
+### Changed
+- Support for Nextcloud 22 with calendar trashbin
+
## 1.2.0 – 2021-01-08
### Changed
- Support for Nextcloud 21
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 59d783e..3faa42a 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -6,7 +6,7 @@
<summary>Receive a notification when an event in a shared calendar was added, modified or deleted.</summary>
<description><![CDATA[Receive a notification when an event in a shared calendar was added, modified or deleted.]]></description>
- <version>1.2.0</version>
+ <version>1.3.0</version>
<licence>agpl</licence>
<author>Joas Schilling</author>
@@ -27,6 +27,6 @@
<screenshot>https://github.com/nickv-nextcloud/event_update_notification/raw/master/docs/demo.png</screenshot>
<dependencies>
- <nextcloud min-version="20" max-version="21" />
+ <nextcloud min-version="20" max-version="22" />
</dependencies>
</info>
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index ab8c010..cedc40a 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -25,6 +25,7 @@ namespace OCA\EventUpdateNotification\AppInfo;
use OCA\DAV\Events\CalendarObjectCreatedEvent;
use OCA\DAV\Events\CalendarObjectDeletedEvent;
+use OCA\DAV\Events\CalendarObjectMovedToTrashEvent;
use OCA\DAV\Events\CalendarObjectUpdatedEvent;
use OCA\EventUpdateNotification\EventListener;
use OCA\EventUpdateNotification\Notifier;
@@ -43,6 +44,7 @@ class Application extends App implements IBootstrap {
$context->registerEventListener(CalendarObjectCreatedEvent::class, EventListener::class);
$context->registerEventListener(CalendarObjectUpdatedEvent::class, EventListener::class);
$context->registerEventListener(CalendarObjectDeletedEvent::class, EventListener::class);
+ $context->registerEventListener(CalendarObjectMovedToTrashEvent::class, EventListener::class);
}
public function boot(IBootContext $context): void {
diff --git a/lib/EventListener.php b/lib/EventListener.php
index d78c427..240a640 100644
--- a/lib/EventListener.php
+++ b/lib/EventListener.php
@@ -27,6 +27,7 @@ namespace OCA\EventUpdateNotification;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\Events\CalendarObjectCreatedEvent;
use OCA\DAV\Events\CalendarObjectDeletedEvent;
+use OCA\DAV\Events\CalendarObjectMovedToTrashEvent;
use OCA\DAV\Events\CalendarObjectUpdatedEvent;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
@@ -64,14 +65,20 @@ class EventListener implements IEventListener {
public function handle(Event $event): void {
if (!($event instanceof CalendarObjectCreatedEvent)
&& !($event instanceof CalendarObjectUpdatedEvent)
- && !($event instanceof CalendarObjectDeletedEvent)) {
+ && !($event instanceof CalendarObjectDeletedEvent)
+ && !($event instanceof CalendarObjectMovedToTrashEvent)) {
return;
}
- $subject = Notifier::SUBJECT_OBJECT_ADD;
- if ($event instanceof CalendarObjectUpdatedEvent) {
+ if ($event instanceof CalendarObjectCreatedEvent) {
+ $subject = Notifier::SUBJECT_OBJECT_ADD;
+ } else if ($event instanceof CalendarObjectUpdatedEvent) {
$subject = Notifier::SUBJECT_OBJECT_UPDATE;
- } else if ($event instanceof CalendarObjectDeletedEvent) {
+ } else {
+ if ($event instanceof CalendarObjectDeletedEvent
+ && substr($event->getObjectData()['uri'], -12) === '-deleted.ics') {
+ return;
+ }
$subject = Notifier::SUBJECT_OBJECT_DELETE;
}