Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13986007
D16758.id.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
D16758.id.diff
View Options
diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
@@ -34,25 +34,22 @@
}
$actor = $this->getActor();
+
+ $invitees = $event->getInvitees();
+
$event->copyFromParent($actor);
$event->setIsStub(0);
- $invitees = $event->getParentEvent()->getInvitees();
-
- $new_invitees = array();
- foreach ($invitees as $invitee) {
- $invitee = id(new PhabricatorCalendarEventInvitee())
- ->setEventPHID($event->getPHID())
- ->setInviteePHID($invitee->getInviteePHID())
- ->setInviterPHID($invitee->getInviterPHID())
- ->setStatus($invitee->getStatus())
- ->save();
-
- $new_invitees[] = $invitee;
- }
+ $event->openTransaction();
+ $event->save();
+ foreach ($invitees as $invitee) {
+ $invitee
+ ->setEventPHID($event->getPHID())
+ ->save();
+ }
+ $event->saveTransaction();
- $event->save();
- $event->attachInvitees($new_invitees);
+ $event->attachInvitees($invitees);
}
public function getTransactionTypes() {
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
@@ -27,7 +27,6 @@
protected $isRecurring = 0;
- private $isGhostEvent = false;
protected $instanceOfEventPHID;
protected $sequenceIndex;
@@ -60,6 +59,9 @@
protected $recurrenceEndDate;
protected $recurrenceFrequency = array();
+ private $isGhostEvent = false;
+ private $stubInvitees;
+
public static function initializeNewCalendarEvent(PhabricatorUser $actor) {
$app = id(new PhabricatorApplicationQuery())
->setViewer($actor)
@@ -449,9 +451,34 @@
}
public function getInvitees() {
+ if ($this->getIsGhostEvent() || $this->getIsStub()) {
+ if ($this->stubInvitees === null) {
+ $this->stubInvitees = $this->newStubInvitees();
+ }
+ return $this->stubInvitees;
+ }
+
return $this->assertAttached($this->invitees);
}
+ private function newStubInvitees() {
+ $parent = $this->getParentEvent();
+
+ $parent_invitees = $parent->getInvitees();
+ $stub_invitees = array();
+
+ foreach ($parent_invitees as $invitee) {
+ $stub_invitee = id(new PhabricatorCalendarEventInvitee())
+ ->setInviteePHID($invitee->getInviteePHID())
+ ->setInviterPHID($invitee->getInviterPHID())
+ ->setStatus(PhabricatorCalendarEventInvitee::STATUS_INVITED);
+
+ $stub_invitees[] = $stub_invitee;
+ }
+
+ return $stub_invitees;
+ }
+
public function attachInvitees(array $invitees) {
$this->invitees = $invitees;
return $this;
@@ -478,6 +505,7 @@
if (!$invited) {
return PhabricatorCalendarEventInvitee::STATUS_UNINVITED;
}
+
$invited = $invited->getStatus();
return $invited;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 22, 12:03 AM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6740111
Default Alt Text
D16758.id.diff (3 KB)
Attached To
Mode
D16758: Make event invitees behave a little better for stub/ghost events
Attached
Detach File
Event Timeline
Log In to Comment