1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

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:
epriestley 2016-07-09 09:12:03 -07:00
parent 3ab6a7e19f
commit ffdb9f06f8
3 changed files with 36 additions and 33 deletions

View file

@ -65,11 +65,40 @@ final class PhabricatorCalendarEditEngine
->setKey('name')
->setLabel(pht('Name'))
->setDescription(pht('Name of the event.'))
->setIsRequired(true)
->setTransactionType(PhabricatorCalendarEventTransaction::TYPE_NAME)
->setConduitDescription(pht('Rename the event.'))
->setConduitTypeDescription(pht('New event name.'))
->setTransactionType(PhabricatorCalendarEventTransaction::TYPE_NAME)
->setIsRequired(true)
->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;

View file

@ -40,6 +40,8 @@ final class PhabricatorCalendarEventEditor
$event->setIsStub(0);
$invitees = $event->getParentEvent()->getInvitees();
$new_invitees = array();
foreach ($invitees as $invitee) {
$invitee = id(new PhabricatorCalendarEventInvitee())
->setEventPHID($event->getPHID())
@ -47,9 +49,12 @@ final class PhabricatorCalendarEventEditor
->setInviterPHID($invitee->getInviterPHID())
->setStatus($invitee->getStatus())
->save();
$new_invitees[] = $invitee;
}
$event->save();
$event->attachInvitees($new_invitees);
}
public function getTransactionTypes() {
@ -67,8 +72,6 @@ final class PhabricatorCalendarEventEditor
$types[] = PhabricatorCalendarEventTransaction::TYPE_RECURRING;
$types[] = PhabricatorCalendarEventTransaction::TYPE_FREQUENCY;
$types[] = PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE;
$types[] = PhabricatorCalendarEventTransaction::TYPE_INSTANCE_OF_EVENT;
$types[] = PhabricatorCalendarEventTransaction::TYPE_SEQUENCE_INDEX;
$types[] = PhabricatorTransactions::TYPE_COMMENT;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
@ -87,10 +90,6 @@ final class PhabricatorCalendarEventEditor
return $object->getRecurrenceFrequency();
case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE:
return $object->getRecurrenceEndDate();
case PhabricatorCalendarEventTransaction::TYPE_INSTANCE_OF_EVENT:
return $object->getInstanceOfEventPHID();
case PhabricatorCalendarEventTransaction::TYPE_SEQUENCE_INDEX:
return $object->getSequenceIndex();
case PhabricatorCalendarEventTransaction::TYPE_NAME:
return $object->getName();
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
@ -131,8 +130,6 @@ final class PhabricatorCalendarEventEditor
switch ($xaction->getTransactionType()) {
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
case PhabricatorCalendarEventTransaction::TYPE_INSTANCE_OF_EVENT:
case PhabricatorCalendarEventTransaction::TYPE_SEQUENCE_INDEX:
case PhabricatorCalendarEventTransaction::TYPE_NAME:
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
@ -159,10 +156,6 @@ final class PhabricatorCalendarEventEditor
return $object->setIsRecurring($xaction->getNewValue());
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
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:
$object->setName($xaction->getNewValue());
return;
@ -202,8 +195,6 @@ final class PhabricatorCalendarEventEditor
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE:
case PhabricatorCalendarEventTransaction::TYPE_INSTANCE_OF_EVENT:
case PhabricatorCalendarEventTransaction::TYPE_SEQUENCE_INDEX:
case PhabricatorCalendarEventTransaction::TYPE_NAME:
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
@ -253,8 +244,6 @@ final class PhabricatorCalendarEventEditor
case PhabricatorCalendarEventTransaction::TYPE_RECURRING:
case PhabricatorCalendarEventTransaction::TYPE_FREQUENCY:
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_END_DATE:
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:

View file

@ -16,9 +16,6 @@ final class PhabricatorCalendarEventTransaction
const TYPE_FREQUENCY = 'calendar.frequency';
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_CONTENT = 'calendar-content';
const MAILTAG_OTHER = 'calendar-other';
@ -48,8 +45,6 @@ final class PhabricatorCalendarEventTransaction
case self::TYPE_RECURRING:
case self::TYPE_FREQUENCY:
case self::TYPE_RECURRENCE_END_DATE:
case self::TYPE_INSTANCE_OF_EVENT:
case self::TYPE_SEQUENCE_INDEX:
$phids[] = $this->getObjectPHID();
break;
case self::TYPE_INVITE:
@ -75,8 +70,6 @@ final class PhabricatorCalendarEventTransaction
case self::TYPE_RECURRING:
case self::TYPE_FREQUENCY:
case self::TYPE_RECURRENCE_END_DATE:
case self::TYPE_INSTANCE_OF_EVENT:
case self::TYPE_SEQUENCE_INDEX:
return ($old === null);
}
return parent::shouldHide();
@ -95,8 +88,6 @@ final class PhabricatorCalendarEventTransaction
case self::TYPE_RECURRING:
case self::TYPE_FREQUENCY:
case self::TYPE_RECURRENCE_END_DATE:
case self::TYPE_INSTANCE_OF_EVENT:
case self::TYPE_SEQUENCE_INDEX:
return 'fa-pencil';
break;
case self::TYPE_INVITE:
@ -283,9 +274,6 @@ final class PhabricatorCalendarEventTransaction
$text = pht('%s has changed the recurrence end date of this event.',
$this->renderHandleLink($author_phid));
return $text;
case self::TYPE_INSTANCE_OF_EVENT:
case self::TYPE_SEQUENCE_INDEX:
return pht('Recurring event has been updated.');
}
return parent::getTitle();
}
@ -501,9 +489,6 @@ final class PhabricatorCalendarEventTransaction
$this->renderHandleLink($object_phid),
$new);
return $text;
case self::TYPE_INSTANCE_OF_EVENT:
case self::TYPE_SEQUENCE_INDEX:
return pht('Recurring event has been updated.');
}
return parent::getTitleForFeed();