aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorSebastianKrupinski <krupinskis05@gmail.com>2024-11-07 15:13:13 -0500
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-11-12 15:43:20 +0000
commitbc77cf925981ce543713ef435c9b8303c9123b5a (patch)
treeddd41990e2fef15c3b86e3478a23ce2539d0c5d4 /apps/dav
parent38694e9acc9c496af5ea858fa35553df4575b9b3 (diff)
downloadnextcloud-server-bc77cf925981ce543713ef435c9b8303c9123b5a.tar.gz
nextcloud-server-bc77cf925981ce543713ef435c9b8303c9123b5a.zip
feat: Add X-NC-Disable-Scheduling property to allow skipping schedulingbackport/49139/stable30
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CalDAV/Schedule/IMipPlugin.php12
-rw-r--r--apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php19
2 files changed, 29 insertions, 2 deletions
diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
index 1958531630a..1cfe8f47cb5 100644
--- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
+++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
@@ -109,8 +109,16 @@ class IMipPlugin extends SabreIMipPlugin {
* @return void
*/
public function schedule(Message $iTipMessage) {
- // Not sending any emails if the system considers the update
- // insignificant.
+
+ // do not send imip messages if external system already did
+ /** @psalm-suppress UndefinedPropertyFetch */
+ if ($iTipMessage->message?->VEVENT?->{'X-NC-DISABLE-SCHEDULING'}?->getValue() === 'true') {
+ if (!$iTipMessage->scheduleStatus) {
+ $iTipMessage->scheduleStatus = '1.0;We got the message, but iMip messages are disabled for this event';
+ }
+ return;
+ }
+ // Not sending any emails if the system considers the update insignificant
if (!$iTipMessage->significantChange) {
if (!$iTipMessage->scheduleStatus) {
$iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email';
diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
index bda3182d117..c8dfe257bf2 100644
--- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
@@ -890,4 +890,23 @@ class IMipPluginTest extends TestCase {
$this->plugin->schedule($message);
$this->assertEquals('1.1', $message->getScheduleStatus());
}
+
+ public function testImipDisabledForEvent(): void {
+ // construct iTip message with event and attendees
+ $calendar = new VCalendar();
+ $calendar->add('VEVENT', ['UID' => 'uid-1234']);
+ $event = $calendar->VEVENT;
+ $event->add('ORGANIZER', 'mailto:gandalf@wiz.ard');
+ $event->add('ATTENDEE', 'mailto:' . 'frodo@hobb.it', ['RSVP' => 'TRUE', 'CN' => 'Frodo']);
+ $event->add('X-NC-DISABLE-SCHEDULING', 'true');
+ $message = new Message();
+ $message->method = 'REQUEST';
+ $message->message = $calendar;
+ $message->sender = 'mailto:gandalf@wiz.ard';
+ $message->senderName = 'Mr. Wizard';
+ $message->recipient = 'mailto:' . 'frodo@hobb.it';
+
+ $this->plugin->schedule($message);
+ $this->assertEquals('1.0;We got the message, but iMip messages are disabled for this event', $message->scheduleStatus);
+ }
}