2016-07-13 00:44:11 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorCalendarEventUntilDateTransaction
|
|
|
|
extends PhabricatorCalendarEventDateTransaction {
|
|
|
|
|
|
|
|
const TRANSACTIONTYPE = 'calendar.recurrenceenddate';
|
|
|
|
|
|
|
|
public function generateOldValue($object) {
|
2016-11-01 20:55:27 +01:00
|
|
|
$editor = $this->getEditor();
|
|
|
|
|
2016-11-02 19:02:26 +01:00
|
|
|
$until = $object->newUntilDateTime();
|
|
|
|
if (!$until) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $until
|
2016-11-01 20:55:27 +01:00
|
|
|
->newAbsoluteDateTime()
|
|
|
|
->setIsAllDay($editor->getOldIsAllDay())
|
|
|
|
->toDictionary();
|
2016-07-13 00:44:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function applyInternalEffects($object, $value) {
|
2016-10-03 19:14:14 +02:00
|
|
|
$actor = $this->getActor();
|
2016-11-01 20:55:27 +01:00
|
|
|
$editor = $this->getEditor();
|
2016-10-03 19:14:14 +02:00
|
|
|
|
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) {
|
|
|
|
$datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($value);
|
|
|
|
$datetime->setIsAllDay($editor->getNewIsAllDay());
|
|
|
|
$object->setUntilDateTime($datetime);
|
|
|
|
} else {
|
|
|
|
$object->setUntilDateTime(null);
|
|
|
|
}
|
2016-07-13 00:44:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle() {
|
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 ($this->getNewValue()) {
|
|
|
|
return pht(
|
|
|
|
'%s changed this event to repeat until %s.',
|
|
|
|
$this->renderAuthor(),
|
|
|
|
$this->renderNewDate());
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s changed this event to repeat forever.',
|
|
|
|
$this->renderAuthor());
|
|
|
|
}
|
2016-07-13 00:44:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitleForFeed() {
|
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 ($this->getNewValue()) {
|
|
|
|
return pht(
|
|
|
|
'%s changed %s to repeat until %s.',
|
|
|
|
$this->renderAuthor(),
|
|
|
|
$this->renderObject(),
|
|
|
|
$this->renderNewDate());
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s changed %s to repeat forever.',
|
|
|
|
$this->renderAuthor(),
|
|
|
|
$this->renderObject());
|
|
|
|
}
|
2016-07-13 00:44:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function getInvalidDateMessage() {
|
|
|
|
return pht('Repeat until date is invalid.');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|