Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14048392
D13121.id31679.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D13121.id31679.diff
View Options
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,20 @@
$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;
+ $instance_of = $event->getInstanceOfEventPHID();
+
+ if (!$instance_of && $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 +172,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;
}
}
}
@@ -308,6 +316,8 @@
protected function willFilterPage(array $events) {
$range_start = $this->rangeBegin;
$range_end = $this->rangeEnd;
+ $instace_of_event_phids = array();
+ $recurring_events = null;
foreach ($events as $key => $event) {
$event_start = $event->getDateFrom();
@@ -325,8 +335,21 @@
foreach ($events as $event) {
$phids[] = $event->getPHID();
+
+ if ($event->getInstanceOfEventPHID != null) {
+ $instace_of_event_phids[] = $event->getInstanceOfEventPHID();
+ }
}
+ if (count($instace_of_event_phids) > 0) {
+ $recurring_events = id(new PhabricatorCalendarEventQuery())
+ ->setViewer($this->getViewer())
+ ->withPHIDs($instace_of_event_phids)
+ ->execute();
+ }
+
+ $recurring_events = mpull($recurring_events, null, 'getPHID');
+
if ($events) {
$invitees = id(new PhabricatorCalendarEventInviteeQuery())
->setViewer($this->getViewer())
@@ -340,6 +363,16 @@
foreach ($events as $event) {
$event_invitees = idx($invitees, $event->getPHID(), array());
$event->attachInvitees($event_invitees);
+
+ $instance_of = $event->getInstanceOfEventPHID();
+ if (!$instance_of) {
+ continue;
+ }
+ $parent = idx($recurring_events, $instance_of);
+ if (!$parent) {
+ unset($events[$key]);
+ }
+ $event->attachParentEvent($parent);
}
$events = msort($events, 'getDateFrom');
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
@@ -33,6 +33,7 @@
const DEFAULT_ICON = 'fa-calendar';
+ private $parentEvent = self::ATTACHABLE;
private $invitees = self::ATTACHABLE;
private $appliedViewer;
@@ -329,6 +330,34 @@
return $uri;
}
+ public function getParentEvent() {
+ return $this->assertAttached($this->parentEvent);
+ }
+
+ public function attachParentEvent($event) {
+ $this->parentEvent = $event;
+ return $this;
+ }
+
+ public function getIsCancelled() {
+ if ($this->instanceOfEventPHID && $this->getIsParentCancelled()) {
+ return true;
+ }
+ return false;
+ }
+
+ public function getIsParentCancelled() {
+ if (!$this->getParentEvent()) {
+ return false;
+ }
+
+ $recurring_event = $this->getParentEvent();
+ if ($recurring_event->getIsCancelled()) {
+ return true;
+ }
+ return false;
+ }
+
/* -( Markup Interface )--------------------------------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 7:40 AM (3 d, 13 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6751961
Default Alt Text
D13121.id31679.diff (3 KB)
Attached To
Mode
D13121: Cancelled recurring events should propogate to real child events
Attached
Detach File
Event Timeline
Log In to Comment