[Pkg-owncloud-commits] [php-sabredav] 230/275: Now we're only sending emails when a change is deemed 'significant'.

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:56:13 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit 2a4440c98cdf72a35a81d4f14f4751c7b4d0a120
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Mon Sep 15 16:17:23 2014 +0100

    Now we're only sending emails when a change is deemed 'significant'.
    
    Issue #492.
---
 lib/CalDAV/Schedule/IMipPlugin.php             |  9 ++++++++
 tests/Sabre/CalDAV/Schedule/IMipPluginTest.php | 31 ++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/lib/CalDAV/Schedule/IMipPlugin.php b/lib/CalDAV/Schedule/IMipPlugin.php
index 95761a3..6f94c2c 100644
--- a/lib/CalDAV/Schedule/IMipPlugin.php
+++ b/lib/CalDAV/Schedule/IMipPlugin.php
@@ -96,6 +96,15 @@ class IMipPlugin extends DAV\ServerPlugin {
      */
     function schedule(ITip\Message $iTipMessage) {
 
+        // 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';
+            }
+            return;
+        }
+
         $summary = $iTipMessage->message->VEVENT->SUMMARY;
 
         $sender = $iTipMessage->sender;
diff --git a/tests/Sabre/CalDAV/Schedule/IMipPluginTest.php b/tests/Sabre/CalDAV/Schedule/IMipPluginTest.php
index 799b143..f1062fd 100644
--- a/tests/Sabre/CalDAV/Schedule/IMipPluginTest.php
+++ b/tests/Sabre/CalDAV/Schedule/IMipPluginTest.php
@@ -147,4 +147,35 @@ ICS;
 
     }
 
+    function testDeliverInsignificantRequest() {
+
+        $message = new Message();
+        $message->sender = 'sender at example.org';
+        $message->senderName = 'Sender';
+        $message->recipient = 'recipient at example.org';
+        $message->recipientName = 'Recipient';
+        $message->method = 'REQUEST';
+        $message->significantChange = false;
+
+        $ics = <<<ICS
+BEGIN:VCALENDAR\r
+METHOD:REQUEST\r
+BEGIN:VEVENT\r
+SUMMARY:Birthday party\r
+END:VEVENT\r
+END:VCALENDAR\r
+
+ICS;
+
+
+        $message->message = Reader::read($ics);
+
+        $result = $this->schedule($message);
+
+        $expected = [];
+        $this->assertEquals($expected, $result);
+        $this->assertEquals('1.0', $message->getScheduleStatus()[0]);
+
+    }
+
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list