mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 10:22:42 +01:00
3e15e0b980
Summary: Fixes T11805. Depends on D16785. This generally tries to smooth out transactions: - All-day stuff now says "Nov 3" instead of "Nov 3 12:00:00 AM". - Fewer weird bugs / extra transactions. - No more silly extra "yeah, you definitely set that event time" transaction on create. Test Plan: Edited events; changed from all-day to not-all-day and back again, viewed transaction log. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11805 Differential Revision: https://secure.phabricator.com/D16786
56 lines
1.3 KiB
PHP
56 lines
1.3 KiB
PHP
<?php
|
|
|
|
final class PhabricatorCalendarEventEndDateTransaction
|
|
extends PhabricatorCalendarEventDateTransaction {
|
|
|
|
const TRANSACTIONTYPE = 'calendar.enddate';
|
|
|
|
public function generateOldValue($object) {
|
|
$editor = $this->getEditor();
|
|
|
|
return $object->newEndDateTimeForEdit()
|
|
->newAbsoluteDateTime()
|
|
->setIsAllDay($editor->getOldIsAllDay())
|
|
->toDictionary();
|
|
}
|
|
|
|
public function applyInternalEffects($object, $value) {
|
|
$actor = $this->getActor();
|
|
$editor = $this->getEditor();
|
|
|
|
$datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($value);
|
|
$datetime->setIsAllDay($editor->getNewIsAllDay());
|
|
|
|
$object->setEndDateTime($datetime);
|
|
}
|
|
|
|
public function shouldHide() {
|
|
if ($this->isCreateTransaction()) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public function getTitle() {
|
|
return pht(
|
|
'%s changed the end date for this event from %s to %s.',
|
|
$this->renderAuthor(),
|
|
$this->renderOldDate(),
|
|
$this->renderNewDate());
|
|
}
|
|
|
|
public function getTitleForFeed() {
|
|
return pht(
|
|
'%s changed the end date for %s from %s to %s.',
|
|
$this->renderAuthor(),
|
|
$this->renderObject(),
|
|
$this->renderOldDate(),
|
|
$this->renderNewDate());
|
|
}
|
|
|
|
protected function getInvalidDateMessage() {
|
|
return pht('End date is invalid.');
|
|
}
|
|
|
|
}
|