2016-07-13 00:44:11 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class PhabricatorCalendarEventDateTransaction
|
|
|
|
extends PhabricatorCalendarEventTransactionType {
|
|
|
|
|
|
|
|
abstract protected function getInvalidDateMessage();
|
|
|
|
|
Smooth out various transaction/editing behaviors for Calendar
Summary:
Ref T11809.
- Allow users to remove the "Until" date from recurring events.
- When removing "Until", show a sensible string ("...set this event to repeat forever.")
- When users go through the "Make Recurring" workflow, don't require them to explicitly select "Recurring: Recurring" from the dropdown. This intent is clear from clicking "Make Recurring".
- When editing "All Future Events", don't literally apply date changes to them, since that doesn't make sense. We update the template, then reschedule any events which haven't been edited already. I think this is what users probably mean if they make this edit.
- When creating an event with a non-default icon, don't show "alice changed the icon from Default to Party.".
- Hide the "recurring mode" transaction, which had no string ("alice edited this Event.") and was redundant anyway.
- Also, add a little piece of developer text to make hunting these things down easier.
Test Plan: Edited various events, parents, children, made events recur, set until, unset until, viewed transactions, rescheduled parents, rescheduled children.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T11809
Differential Revision: https://secure.phabricator.com/D16796
2016-11-02 23:15:09 +01:00
|
|
|
public function isInheritedEdit() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-07-13 00:44:11 +02:00
|
|
|
public function generateNewValue($object, $value) {
|
2016-11-01 20:55:27 +01:00
|
|
|
$editor = $this->getEditor();
|
Smooth out various transaction/editing behaviors for Calendar
Summary:
Ref T11809.
- Allow users to remove the "Until" date from recurring events.
- When removing "Until", show a sensible string ("...set this event to repeat forever.")
- When users go through the "Make Recurring" workflow, don't require them to explicitly select "Recurring: Recurring" from the dropdown. This intent is clear from clicking "Make Recurring".
- When editing "All Future Events", don't literally apply date changes to them, since that doesn't make sense. We update the template, then reschedule any events which haven't been edited already. I think this is what users probably mean if they make this edit.
- When creating an event with a non-default icon, don't show "alice changed the icon from Default to Party.".
- Hide the "recurring mode" transaction, which had no string ("alice edited this Event.") and was redundant anyway.
- Also, add a little piece of developer text to make hunting these things down easier.
Test Plan: Edited various events, parents, children, made events recur, set until, unset until, viewed transactions, rescheduled parents, rescheduled children.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T11809
Differential Revision: https://secure.phabricator.com/D16796
2016-11-02 23:15:09 +01:00
|
|
|
|
|
|
|
if ($value->isDisabled()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-11-01 20:55:27 +01:00
|
|
|
return $value->newPhutilDateTime()
|
|
|
|
->setIsAllDay($editor->getNewIsAllDay())
|
|
|
|
->newAbsoluteDateTime()
|
|
|
|
->toDictionary();
|
2016-07-13 00:44:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function validateTransactions($object, array $xactions) {
|
|
|
|
$errors = array();
|
|
|
|
|
|
|
|
foreach ($xactions as $xaction) {
|
|
|
|
if ($xaction->getNewValue()->isValid()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$message = $this->getInvalidDateMessage();
|
|
|
|
$errors[] = $this->newInvalidError($message, $xaction);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $errors;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|