Page MenuHomePhabricator

D13089.diff
No OneTemporary

D13089.diff

diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
@@ -203,15 +203,17 @@
PhabricatorCalendarEventTransaction::TYPE_NAME)
->setNewValue($name);
- $xactions[] = id(new PhabricatorCalendarEventTransaction())
- ->setTransactionType(
- PhabricatorCalendarEventTransaction::TYPE_RECURRING)
- ->setNewValue($is_recurring);
-
- $xactions[] = id(new PhabricatorCalendarEventTransaction())
- ->setTransactionType(
- PhabricatorCalendarEventTransaction::TYPE_FREQUENCY)
- ->setNewValue(array('rule' => $frequency));
+ if ($this->isCreate()) {
+ $xactions[] = id(new PhabricatorCalendarEventTransaction())
+ ->setTransactionType(
+ PhabricatorCalendarEventTransaction::TYPE_RECURRING)
+ ->setNewValue($is_recurring);
+
+ $xactions[] = id(new PhabricatorCalendarEventTransaction())
+ ->setTransactionType(
+ PhabricatorCalendarEventTransaction::TYPE_FREQUENCY)
+ ->setNewValue(array('rule' => $frequency));
+ }
$xactions[] = id(new PhabricatorCalendarEventTransaction())
->setTransactionType(
@@ -294,37 +296,42 @@
}
}
+ $is_recurring_checkbox = null;
+ $recurrence_frequency_select = null;
+
$name = id(new AphrontFormTextControl())
->setLabel(pht('Name'))
->setName('name')
->setValue($name)
->setError($error_name);
- Javelin::initBehavior('recurring-edit', array(
- 'isRecurring' => $is_recurring_id,
- 'frequency' => $frequency_id,
- ));
+ if ($this->isCreate()) {
+ Javelin::initBehavior('recurring-edit', array(
+ 'isRecurring' => $is_recurring_id,
+ 'frequency' => $frequency_id,
+ ));
- $is_recurring_checkbox = id(new AphrontFormCheckboxControl())
- ->addCheckbox(
- 'isRecurring',
- 1,
- pht('Recurring Event'),
- $is_recurring,
- $is_recurring_id);
-
- $recurrence_frequency_select = id(new AphrontFormSelectControl())
- ->setName('frequency')
- ->setOptions(array(
- 'daily' => pht('Daily'),
- 'weekly' => pht('Weekly'),
- 'monthly' => pht('Monthly'),
- 'yearly' => pht('Yearly'),
- ))
- ->setValue($frequency)
- ->setLabel(pht('Recurring Event Frequency'))
- ->setID($frequency_id)
- ->setDisabled(!$is_recurring);
+ $is_recurring_checkbox = id(new AphrontFormCheckboxControl())
+ ->addCheckbox(
+ 'isRecurring',
+ 1,
+ pht('Recurring Event'),
+ $is_recurring,
+ $is_recurring_id);
+
+ $recurrence_frequency_select = id(new AphrontFormSelectControl())
+ ->setName('frequency')
+ ->setOptions(array(
+ 'daily' => pht('Daily'),
+ 'weekly' => pht('Weekly'),
+ 'monthly' => pht('Monthly'),
+ 'yearly' => pht('Yearly'),
+ ))
+ ->setValue($frequency)
+ ->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 @@
->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)
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
@@ -135,7 +135,7 @@
$event,
PhabricatorPolicyCapability::CAN_EDIT);
- if (($event->getIsRecurring() && $event->getIsGhostEvent())) {
+ if ($event->getIsRecurring() && $event->getIsGhostEvent()) {
$index = $event->getSequenceIndex();
$actions->addAction(
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -279,6 +279,9 @@
$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 @@
->setDateTo($date + $duration)
->setIsRecurring(true)
->setRecurrenceFrequency($this->recurrenceFrequency)
- ->setInstanceOfEventPHID($this->getPHID())
+ ->setInstanceOfEventPHID($instance_of)
->setSequenceIndex($sequence_index)
->setEditPolicy($edit_policy);

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 31, 2:24 PM (16 h, 32 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7078772
Default Alt Text
D13089.diff (5 KB)

Event Timeline