@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make event invitees behave a little better for stub/ghost events

Summary:
Ref T11326. Currently:

- The month view and day view (ghosts) don't show that you're invited to a child event.
- The detail view copies the invite list, including attending status, but only //after// it shows the page for the first time.

Instead, for now, just do this:

- Ghosts/stubs use the parent invite list, but treat everyone as "invited".
- Materializing a stub just saves the list as-is (i.e., invited, not a copy of attending/declined/etc).

This behavior may need some refining eventually but is at least reasonable (not obviously bad/buggy).

Test Plan:
- Viewed month/day views, now shown as "invited".
- Viewed detail view, now invitee list shows up properly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11326

Differential Revision: https://secure.phabricator.com/D16758

+41 -16
+12 -15
src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
··· 34 34 } 35 35 36 36 $actor = $this->getActor(); 37 + 38 + $invitees = $event->getInvitees(); 39 + 37 40 $event->copyFromParent($actor); 38 41 $event->setIsStub(0); 39 42 40 - $invitees = $event->getParentEvent()->getInvitees(); 43 + $event->openTransaction(); 44 + $event->save(); 45 + foreach ($invitees as $invitee) { 46 + $invitee 47 + ->setEventPHID($event->getPHID()) 48 + ->save(); 49 + } 50 + $event->saveTransaction(); 41 51 42 - $new_invitees = array(); 43 - foreach ($invitees as $invitee) { 44 - $invitee = id(new PhabricatorCalendarEventInvitee()) 45 - ->setEventPHID($event->getPHID()) 46 - ->setInviteePHID($invitee->getInviteePHID()) 47 - ->setInviterPHID($invitee->getInviterPHID()) 48 - ->setStatus($invitee->getStatus()) 49 - ->save(); 50 - 51 - $new_invitees[] = $invitee; 52 - } 53 - 54 - $event->save(); 55 - $event->attachInvitees($new_invitees); 52 + $event->attachInvitees($invitees); 56 53 } 57 54 58 55 public function getTransactionTypes() {
+29 -1
src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 27 27 28 28 protected $isRecurring = 0; 29 29 30 - private $isGhostEvent = false; 31 30 protected $instanceOfEventPHID; 32 31 protected $sequenceIndex; 33 32 ··· 59 58 protected $dateTo; 60 59 protected $recurrenceEndDate; 61 60 protected $recurrenceFrequency = array(); 61 + 62 + private $isGhostEvent = false; 63 + private $stubInvitees; 62 64 63 65 public static function initializeNewCalendarEvent(PhabricatorUser $actor) { 64 66 $app = id(new PhabricatorApplicationQuery()) ··· 449 451 } 450 452 451 453 public function getInvitees() { 454 + if ($this->getIsGhostEvent() || $this->getIsStub()) { 455 + if ($this->stubInvitees === null) { 456 + $this->stubInvitees = $this->newStubInvitees(); 457 + } 458 + return $this->stubInvitees; 459 + } 460 + 452 461 return $this->assertAttached($this->invitees); 462 + } 463 + 464 + private function newStubInvitees() { 465 + $parent = $this->getParentEvent(); 466 + 467 + $parent_invitees = $parent->getInvitees(); 468 + $stub_invitees = array(); 469 + 470 + foreach ($parent_invitees as $invitee) { 471 + $stub_invitee = id(new PhabricatorCalendarEventInvitee()) 472 + ->setInviteePHID($invitee->getInviteePHID()) 473 + ->setInviterPHID($invitee->getInviterPHID()) 474 + ->setStatus(PhabricatorCalendarEventInvitee::STATUS_INVITED); 475 + 476 + $stub_invitees[] = $stub_invitee; 477 + } 478 + 479 + return $stub_invitees; 453 480 } 454 481 455 482 public function attachInvitees(array $invitees) { ··· 478 505 if (!$invited) { 479 506 return PhabricatorCalendarEventInvitee::STATUS_UNINVITED; 480 507 } 508 + 481 509 $invited = $invited->getStatus(); 482 510 return $invited; 483 511 }