Both ghost instances and exceptions to generated ghosts should be editable

Summary: Fixes T8369, Both ghost instances and exceptions to generated ghosts should be editable

Test Plan: Create recurring event, open /E{id}/1, edit, save. New exception should not be "recurring", and should be editable, as the regular ghost events.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8369

Differential Revision: https://secure.phabricator.com/D13089
This commit is contained in:
lkassianik 2015-05-31 20:45:51 -07:00
parent 9c5d9e3f47
commit bb92819c09
3 changed files with 53 additions and 36 deletions

View file

@ -203,6 +203,7 @@ final class PhabricatorCalendarEventEditController
PhabricatorCalendarEventTransaction::TYPE_NAME)
->setNewValue($name);
if ($this->isCreate()) {
$xactions[] = id(new PhabricatorCalendarEventTransaction())
->setTransactionType(
PhabricatorCalendarEventTransaction::TYPE_RECURRING)
@ -212,6 +213,7 @@ final class PhabricatorCalendarEventEditController
->setTransactionType(
PhabricatorCalendarEventTransaction::TYPE_FREQUENCY)
->setNewValue(array('rule' => $frequency));
}
$xactions[] = id(new PhabricatorCalendarEventTransaction())
->setTransactionType(
@ -294,12 +296,16 @@ final class PhabricatorCalendarEventEditController
}
}
$is_recurring_checkbox = null;
$recurrence_frequency_select = null;
$name = id(new AphrontFormTextControl())
->setLabel(pht('Name'))
->setName('name')
->setValue($name)
->setError($error_name);
if ($this->isCreate()) {
Javelin::initBehavior('recurring-edit', array(
'isRecurring' => $is_recurring_id,
'frequency' => $frequency_id,
@ -325,6 +331,7 @@ final class PhabricatorCalendarEventEditController
->setLabel(pht('Recurring Event Frequency'))
->setID($frequency_id)
->setDisabled(!$is_recurring);
}
Javelin::initBehavior('event-all-day', array(
'allDayID' => $all_day_id,
@ -409,9 +416,16 @@ final class PhabricatorCalendarEventEditController
->addHiddenInput('next', $next_workflow)
->addHiddenInput('query', $uri_query)
->setUser($viewer)
->appendChild($name)
->appendChild($is_recurring_checkbox)
->appendChild($recurrence_frequency_select)
->appendChild($name);
if ($is_recurring_checkbox) {
$form->appendChild($is_recurring_checkbox);
}
if ($recurrence_frequency_select) {
$form->appendControl($recurrence_frequency_select);
}
$form
->appendChild($all_day_checkbox)
->appendChild($start_control)
->appendChild($end_control)

View file

@ -135,7 +135,7 @@ final class PhabricatorCalendarEventViewController
$event,
PhabricatorPolicyCapability::CAN_EDIT);
if (($event->getIsRecurring() && $event->getIsGhostEvent())) {
if ($event->getIsRecurring() && $event->getIsGhostEvent()) {
$index = $event->getSequenceIndex();
$actions->addAction(

View file

@ -279,6 +279,9 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
$frequency = $this->getFrequencyUnit();
$modify_key = '+'.$sequence_index.' '.$frequency;
$instance_of = ($this->getPHID()) ?
$this->getPHID() : $this->instanceOfEventPHID;
$date = $this->dateFrom;
$date_time = PhabricatorTime::getDateTimeFromEpoch($date, $actor);
$date_time->modify($modify_key);
@ -294,7 +297,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
->setDateTo($date + $duration)
->setIsRecurring(true)
->setRecurrenceFrequency($this->recurrenceFrequency)
->setInstanceOfEventPHID($this->getPHID())
->setInstanceOfEventPHID($instance_of)
->setSequenceIndex($sequence_index)
->setEditPolicy($edit_policy);