[Pkg-owncloud-commits] [php-sabre-vobject] 34/38: No longer generate another DECLINE when an attendee deletes an already declined event.

David Prévot taffit at moszumanska.debian.org
Tue Sep 23 03:10:23 UTC 2014


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

taffit pushed a commit to branch upstream
in repository php-sabre-vobject.

commit 7ec8b58772f61b2ac5ac2c5356d7f5e94608bfd3
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Fri Sep 19 17:46:22 2014 +0100

    No longer generate another DECLINE when an attendee deletes an already declined event.
    
    Fixes #127.
---
 ChangeLog.md                                   |  2 +
 lib/ITip/Broker.php                            | 14 ++++---
 tests/VObject/ITip/BrokerAttendeeReplyTest.php | 57 ++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 5 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index 0231120..03a9008 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -18,6 +18,8 @@ ChangeLog
 * #136: Validator rejects *all* control characters. We were missing a few.
 * #133: Splitter objects will throw exceptions when receiving incompatible
   objects.
+* #127: Attendees who delete recurring event instances events they had already
+  declined earlier will no longer generate another reply.
 
 3.3.1 (2014-08-18)
 ------------------
diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php
index 2bd549f..134e8d3 100644
--- a/lib/ITip/Broker.php
+++ b/lib/ITip/Broker.php
@@ -649,11 +649,15 @@ class Broker {
             foreach($eventInfo['exdate'] as $exDate) {
 
                 if (!in_array($exDate, $oldEventInfo['exdate'])) {
-                    $instances[$exDate] = array(
-                        'id' => $exDate,
-                        'oldstatus' => $instances['master']['oldstatus'],
-                        'newstatus' => 'DECLINED',
-                    );
+                    if (isset($instances[$exDate])) {
+                        $instances[$exDate]['newstatus'] = 'DECLINED';
+                    } else {
+                        $instances[$exDate] = array(
+                            'id' => $exDate,
+                            'oldstatus' => null,
+                            'newstatus' => 'DECLINED',
+                        );
+                    }
                 }
 
             }
diff --git a/tests/VObject/ITip/BrokerAttendeeReplyTest.php b/tests/VObject/ITip/BrokerAttendeeReplyTest.php
index 9d98c8a..9737d4c 100644
--- a/tests/VObject/ITip/BrokerAttendeeReplyTest.php
+++ b/tests/VObject/ITip/BrokerAttendeeReplyTest.php
@@ -573,4 +573,61 @@ ICS;
 
     }
 
+    /**
+     * In this test, a new exception is created by an attendee as well.
+     *
+     * Except in this case, there was already an overridden event, and the
+     * overridden event was marked as cancelled by the attendee.
+     *
+     * For any other attendence status, the new status would have been
+     * declined, but for this, no message should we sent.
+     */
+    function testDontCreateReplyWhenEventWasDeclined() {
+
+
+        $oldMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+DTSTART:20140811T200000Z
+RRULE:FREQ=WEEKLY
+ORGANIZER:mailto:organizer at example.org
+ATTENDEE:mailto:one at example.org
+END:VEVENT
+BEGIN:VEVENT
+RECURRENCE-ID:20140818T200000Z
+UID:foobar
+SEQUENCE:1
+DTSTART:20140818T200000Z
+RRULE:FREQ=WEEKLY
+ORGANIZER:mailto:organizer at example.org
+ATTENDEE;PARTSTAT=DECLINED:mailto:one at example.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $newMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+DTSTART:20140811T200000Z
+RRULE:FREQ=WEEKLY
+ORGANIZER:mailto:organizer at example.org
+ATTENDEE:mailto:one at example.org
+EXDATE:20140818T200000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $version = \Sabre\VObject\Version::VERSION;
+        $expected = array();
+
+        $result = $this->parse($oldMessage, $newMessage, $expected);
+
+    }
+
 }

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



More information about the Pkg-owncloud-commits mailing list