Move more event fields to EditEngine
Summary: Ref T9275. This moves description, icon, and cancel/uncancel to EditEngine. It removes TYPE_SEQUENCE_INDEX and TYPE_INSTANCE_OF_EVENT. These are currently never generated and I do not expect to genereate them (instead, these changes happen automatically when you edit a stub). Test Plan: Edited an event with normal and pro edit forms. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9275 Differential Revision: https://secure.phabricator.com/D16264
This commit is contained in:
parent
3ab6a7e19f
commit
ffdb9f06f8
|
@ -65,11 +65,40 @@ final class PhabricatorCalendarEditEngine
|
||||||
->setKey('name')
|
->setKey('name')
|
||||||
->setLabel(pht('Name'))
|
->setLabel(pht('Name'))
|
||||||
->setDescription(pht('Name of the event.'))
|
->setDescription(pht('Name of the event.'))
|
||||||
|
->setIsRequired(true)
|
||||||
|
->setTransactionType(PhabricatorCalendarEventTransaction::TYPE_NAME)
|
||||||
->setConduitDescription(pht('Rename the event.'))
|
->setConduitDescription(pht('Rename the event.'))
|
||||||
->setConduitTypeDescription(pht('New event name.'))
|
->setConduitTypeDescription(pht('New event name.'))
|
||||||
->setTransactionType(PhabricatorCalendarEventTransaction::TYPE_NAME)
|
|
||||||
->setIsRequired(true)
|
|
||||||
->setValue($object->getName()),
|
->setValue($object->getName()),
|
||||||
|
id(new PhabricatorRemarkupEditField())
|
||||||
|
->setKey('description')
|
||||||
|
->setLabel(pht('Description'))
|
||||||
|
->setDescription(pht('Description of the event.'))
|
||||||
|
->setTransactionType(
|
||||||
|
PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION)
|
||||||
|
->setConduitDescription(pht('Update the event description.'))
|
||||||
|
->setConduitTypeDescription(pht('New event description.'))
|
||||||
|
->setValue($object->getDescription()),
|
||||||
|
id(new PhabricatorBoolEditField())
|
||||||
|
->setKey('cancelled')
|
||||||
|
->setOptions(pht('Active'), pht('Cancelled'))
|
||||||
|
->setLabel(pht('Cancelled'))
|
||||||
|
->setDescription(pht('Cancel the event.'))
|
||||||
|
->setTransactionType(
|
||||||
|
PhabricatorCalendarEventTransaction::TYPE_CANCEL)
|
||||||
|
->setIsConduitOnly(true)
|
||||||
|
->setConduitDescription(pht('Cancel or restore the event.'))
|
||||||
|
->setConduitTypeDescription(pht('True to cancel the event.'))
|
||||||
|
->setValue($object->getIsCancelled()),
|
||||||
|
id(new PhabricatorIconSetEditField())
|
||||||
|
->setKey('icon')
|
||||||
|
->setLabel(pht('Icon'))
|
||||||
|
->setIconSet(new PhabricatorCalendarIconSet())
|
||||||
|
->setTransactionType(PhabricatorCalendarEventTransaction::TYPE_ICON)
|
||||||
|
->setDescription(pht('Event icon.'))
|
||||||
|
->setConduitDescription(pht('Change the event icon.'))
|
||||||
|
->setConduitTypeDescription(pht('New event icon.'))
|
||||||
|
->setValue($object->getIcon()),
|
||||||
);
|
);
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
|
|
|
@ -40,6 +40,8 @@ final class PhabricatorCalendarEventEditor
|
||||||
$event->setIsStub(0);
|
$event->setIsStub(0);
|
||||||
|
|
||||||
$invitees = $event->getParentEvent()->getInvitees();
|
$invitees = $event->getParentEvent()->getInvitees();
|
||||||
|
|
||||||
|
$new_invitees = array();
|
||||||
foreach ($invitees as $invitee) {
|
foreach ($invitees as $invitee) {
|
||||||
$invitee = id(new PhabricatorCalendarEventInvitee())
|
$invitee = id(new PhabricatorCalendarEventInvitee())
|
||||||
->setEventPHID($event->getPHID())
|
->setEventPHID($event->getPHID())
|
||||||
|
@ -47,9 +49,12 @@ final class PhabricatorCalendarEventEditor
|
||||||
->setInviterPHID($invitee->getInviterPHID())
|
->setInviterPHID($invitee->getInviterPHID())
|
||||||
->setStatus($invitee->getStatus())
|
->setStatus($invitee->getStatus())
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
$new_invitees[] = $invitee;
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->save();
|
$event->save();
|
||||||
|
$event->attachInvitees($new_invitees);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTransactionTypes() {
|
public function getTransactionTypes() {
|
||||||
|
@ -67,8 +72,6 @@ final class PhabricatorCalendarEventEditor
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_RECURRING;
|
$types[] = PhabricatorCalendarEventTransaction::TYPE_RECURRING;
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_FREQUENCY;
|
$types[] = PhabricatorCalendarEventTransaction::TYPE_FREQUENCY;
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE;
|
$types[] = PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE;
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_INSTANCE_OF_EVENT;
|
|
||||||
$types[] = PhabricatorCalendarEventTransaction::TYPE_SEQUENCE_INDEX;
|
|
||||||
|
|
||||||
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
||||||
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||||
|
@ -87,10 +90,6 @@ final class PhabricatorCalendarEventEditor
|
||||||
return $object->getRecurrenceFrequency();
|
return $object->getRecurrenceFrequency();
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE:
|
||||||
return $object->getRecurrenceEndDate();
|
return $object->getRecurrenceEndDate();
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_INSTANCE_OF_EVENT:
|
|
||||||
return $object->getInstanceOfEventPHID();
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_SEQUENCE_INDEX:
|
|
||||||
return $object->getSequenceIndex();
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_NAME:
|
case PhabricatorCalendarEventTransaction::TYPE_NAME:
|
||||||
return $object->getName();
|
return $object->getName();
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
|
||||||
|
@ -131,8 +130,6 @@ final class PhabricatorCalendarEventEditor
|
||||||
switch ($xaction->getTransactionType()) {
|
switch ($xaction->getTransactionType()) {
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
|
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
|
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_INSTANCE_OF_EVENT:
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_SEQUENCE_INDEX:
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_NAME:
|
case PhabricatorCalendarEventTransaction::TYPE_NAME:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
|
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
|
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
|
||||||
|
@ -159,10 +156,6 @@ final class PhabricatorCalendarEventEditor
|
||||||
return $object->setIsRecurring($xaction->getNewValue());
|
return $object->setIsRecurring($xaction->getNewValue());
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
|
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
|
||||||
return $object->setRecurrenceFrequency($xaction->getNewValue());
|
return $object->setRecurrenceFrequency($xaction->getNewValue());
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_INSTANCE_OF_EVENT:
|
|
||||||
return $object->setInstanceOfEventPHID($xaction->getNewValue());
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_SEQUENCE_INDEX:
|
|
||||||
return $object->setSequenceIndex($xaction->getNewValue());
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_NAME:
|
case PhabricatorCalendarEventTransaction::TYPE_NAME:
|
||||||
$object->setName($xaction->getNewValue());
|
$object->setName($xaction->getNewValue());
|
||||||
return;
|
return;
|
||||||
|
@ -202,8 +195,6 @@ final class PhabricatorCalendarEventEditor
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
|
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
|
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_INSTANCE_OF_EVENT:
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_SEQUENCE_INDEX:
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_NAME:
|
case PhabricatorCalendarEventTransaction::TYPE_NAME:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
||||||
|
@ -253,8 +244,6 @@ final class PhabricatorCalendarEventEditor
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
|
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
|
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_INSTANCE_OF_EVENT:
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_SEQUENCE_INDEX:
|
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
|
||||||
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
|
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
|
||||||
|
|
|
@ -16,9 +16,6 @@ final class PhabricatorCalendarEventTransaction
|
||||||
const TYPE_FREQUENCY = 'calendar.frequency';
|
const TYPE_FREQUENCY = 'calendar.frequency';
|
||||||
const TYPE_RECURRENCE_END_DATE = 'calendar.recurrenceenddate';
|
const TYPE_RECURRENCE_END_DATE = 'calendar.recurrenceenddate';
|
||||||
|
|
||||||
const TYPE_INSTANCE_OF_EVENT = 'calendar.instanceofevent';
|
|
||||||
const TYPE_SEQUENCE_INDEX = 'calendar.sequenceindex';
|
|
||||||
|
|
||||||
const MAILTAG_RESCHEDULE = 'calendar-reschedule';
|
const MAILTAG_RESCHEDULE = 'calendar-reschedule';
|
||||||
const MAILTAG_CONTENT = 'calendar-content';
|
const MAILTAG_CONTENT = 'calendar-content';
|
||||||
const MAILTAG_OTHER = 'calendar-other';
|
const MAILTAG_OTHER = 'calendar-other';
|
||||||
|
@ -48,8 +45,6 @@ final class PhabricatorCalendarEventTransaction
|
||||||
case self::TYPE_RECURRING:
|
case self::TYPE_RECURRING:
|
||||||
case self::TYPE_FREQUENCY:
|
case self::TYPE_FREQUENCY:
|
||||||
case self::TYPE_RECURRENCE_END_DATE:
|
case self::TYPE_RECURRENCE_END_DATE:
|
||||||
case self::TYPE_INSTANCE_OF_EVENT:
|
|
||||||
case self::TYPE_SEQUENCE_INDEX:
|
|
||||||
$phids[] = $this->getObjectPHID();
|
$phids[] = $this->getObjectPHID();
|
||||||
break;
|
break;
|
||||||
case self::TYPE_INVITE:
|
case self::TYPE_INVITE:
|
||||||
|
@ -75,8 +70,6 @@ final class PhabricatorCalendarEventTransaction
|
||||||
case self::TYPE_RECURRING:
|
case self::TYPE_RECURRING:
|
||||||
case self::TYPE_FREQUENCY:
|
case self::TYPE_FREQUENCY:
|
||||||
case self::TYPE_RECURRENCE_END_DATE:
|
case self::TYPE_RECURRENCE_END_DATE:
|
||||||
case self::TYPE_INSTANCE_OF_EVENT:
|
|
||||||
case self::TYPE_SEQUENCE_INDEX:
|
|
||||||
return ($old === null);
|
return ($old === null);
|
||||||
}
|
}
|
||||||
return parent::shouldHide();
|
return parent::shouldHide();
|
||||||
|
@ -95,8 +88,6 @@ final class PhabricatorCalendarEventTransaction
|
||||||
case self::TYPE_RECURRING:
|
case self::TYPE_RECURRING:
|
||||||
case self::TYPE_FREQUENCY:
|
case self::TYPE_FREQUENCY:
|
||||||
case self::TYPE_RECURRENCE_END_DATE:
|
case self::TYPE_RECURRENCE_END_DATE:
|
||||||
case self::TYPE_INSTANCE_OF_EVENT:
|
|
||||||
case self::TYPE_SEQUENCE_INDEX:
|
|
||||||
return 'fa-pencil';
|
return 'fa-pencil';
|
||||||
break;
|
break;
|
||||||
case self::TYPE_INVITE:
|
case self::TYPE_INVITE:
|
||||||
|
@ -283,9 +274,6 @@ final class PhabricatorCalendarEventTransaction
|
||||||
$text = pht('%s has changed the recurrence end date of this event.',
|
$text = pht('%s has changed the recurrence end date of this event.',
|
||||||
$this->renderHandleLink($author_phid));
|
$this->renderHandleLink($author_phid));
|
||||||
return $text;
|
return $text;
|
||||||
case self::TYPE_INSTANCE_OF_EVENT:
|
|
||||||
case self::TYPE_SEQUENCE_INDEX:
|
|
||||||
return pht('Recurring event has been updated.');
|
|
||||||
}
|
}
|
||||||
return parent::getTitle();
|
return parent::getTitle();
|
||||||
}
|
}
|
||||||
|
@ -501,9 +489,6 @@ final class PhabricatorCalendarEventTransaction
|
||||||
$this->renderHandleLink($object_phid),
|
$this->renderHandleLink($object_phid),
|
||||||
$new);
|
$new);
|
||||||
return $text;
|
return $text;
|
||||||
case self::TYPE_INSTANCE_OF_EVENT:
|
|
||||||
case self::TYPE_SEQUENCE_INDEX:
|
|
||||||
return pht('Recurring event has been updated.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getTitleForFeed();
|
return parent::getTitleForFeed();
|
||||||
|
|
Loading…
Reference in a new issue