mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
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
This commit is contained in:
parent
12d29d8206
commit
8e9c20c9ae
2 changed files with 41 additions and 16 deletions
|
@ -34,25 +34,22 @@ final class PhabricatorCalendarEventEditor
|
|||
}
|
||||
|
||||
$actor = $this->getActor();
|
||||
|
||||
$invitees = $event->getInvitees();
|
||||
|
||||
$event->copyFromParent($actor);
|
||||
$event->setIsStub(0);
|
||||
|
||||
$invitees = $event->getParentEvent()->getInvitees();
|
||||
$event->openTransaction();
|
||||
$event->save();
|
||||
foreach ($invitees as $invitee) {
|
||||
$invitee
|
||||
->setEventPHID($event->getPHID())
|
||||
->save();
|
||||
}
|
||||
$event->saveTransaction();
|
||||
|
||||
$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->save();
|
||||
$event->attachInvitees($new_invitees);
|
||||
$event->attachInvitees($invitees);
|
||||
}
|
||||
|
||||
public function getTransactionTypes() {
|
||||
|
|
|
@ -27,7 +27,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
|
||||
protected $isRecurring = 0;
|
||||
|
||||
private $isGhostEvent = false;
|
||||
protected $instanceOfEventPHID;
|
||||
protected $sequenceIndex;
|
||||
|
||||
|
@ -60,6 +59,9 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
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 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
}
|
||||
|
||||
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 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
if (!$invited) {
|
||||
return PhabricatorCalendarEventInvitee::STATUS_UNINVITED;
|
||||
}
|
||||
|
||||
$invited = $invited->getStatus();
|
||||
return $invited;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue