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
|
|
|
|
2016-11-01 20:55:27 +01:00
|
|
|
$datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($value);
|
|
|
|
$datetime->setIsAllDay($editor->getNewIsAllDay());
|
|
|
|
|
2016-10-03 19:14:14 +02:00
|
|
|
$object->setUntilDateTime($datetime);
|
2016-07-13 00:44:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle() {
|
|
|
|
return pht(
|
|
|
|
'%s changed this event to repeat until %s.',
|
|
|
|
$this->renderAuthor(),
|
|
|
|
$this->renderNewDate());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitleForFeed() {
|
|
|
|
return pht(
|
|
|
|
'%s changed %s to repeat until %s.',
|
|
|
|
$this->renderAuthor(),
|
|
|
|
$this->renderObject(),
|
|
|
|
$this->renderNewDate());
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getInvalidDateMessage() {
|
|
|
|
return pht('Repeat until date is invalid.');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|