Page MenuHomePhabricator

D13121.id31677.diff
No OneTemporary

D13121.id31677.diff

diff --git a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
--- a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
@@ -108,12 +108,18 @@
$map = array();
$instance_sequence_pairs = array();
- foreach ($events as $event) {
+ foreach ($events as $key => $event) {
$sequence_start = 0;
$sequence_end = null;
$duration = $event->getDateTo() - $event->getDateFrom();
$end = null;
+ if ($event->getInstanceOfEventPHID() && $this->isCancelled !== null) {
+ if ($event->getIsCancelled() != $this->isCancelled) {
+ unset($events[$key]);
+ }
+ }
+
if ($event->getIsRecurring() && !$event->getInstanceOfEventPHID()) {
$frequency = $event->getFrequencyUnit();
$modify_key = '+1 '.$frequency;
@@ -164,8 +170,8 @@
$instance_sequence_pairs[] = array($event->getPHID(), $index);
$events[] = $event->generateNthGhost($index, $viewer);
- $key = last_key($events);
- $map[$event->getPHID()][$index] = $key;
+ $last_key = last_key($events);
+ $map[$event->getPHID()][$index] = $last_key;
}
}
}
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -329,6 +329,30 @@
return $uri;
}
+ public function getIsCancelled() {
+ if ($this->instanceOfEventPHID !== null && $this->getIsParentCancelled()) {
+ return true;
+ }
+ return $this->isCancelled;
+ }
+
+ public function getIsParentCancelled() {
+ if ($this->instanceOfEventPHID) {
+ return false;
+ }
+ $viewer = $this->appliedViewer;
+ $recurring_phid = $this->instanceOfEventPHID;
+ $recurring_event = id(new PhabricatorCalendarEventQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($recurring_phid))
+ ->executeOne();
+
+ if ($recurring_phid && $recurring_event->getIsCancelled()) {
+ return true;
+ }
+ return false;
+ }
+
/* -( Markup Interface )--------------------------------------------------- */

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 17, 6:55 PM (5 d, 16 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7708749
Default Alt Text
D13121.id31677.diff (2 KB)

Event Timeline