mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
7b09f5698f
Summary: Ref T9275. Swaps Calendar over to modular transactions. Theoretically, this has almost no effect on anything. Ref T10633. I didn't actually do anything here yet, but this gets us ready to put timestamps in email. Test Plan: Created and edited a bunch of events, nothing seemed catastrophically broken. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9275, T10633 Differential Revision: https://secure.phabricator.com/D16286
46 lines
1,012 B
PHP
46 lines
1,012 B
PHP
<?php
|
|
|
|
final class PhabricatorCalendarEventCancelTransaction
|
|
extends PhabricatorCalendarEventTransactionType {
|
|
|
|
const TRANSACTIONTYPE = 'calendar.cancel';
|
|
|
|
public function generateOldValue($object) {
|
|
return (int)$object->getIsCancelled();
|
|
}
|
|
|
|
public function generateNewValue($object, $value) {
|
|
return (int)$value;
|
|
}
|
|
|
|
public function applyInternalEffects($object, $value) {
|
|
$object->setIsCancelled($value);
|
|
}
|
|
|
|
public function getTitle() {
|
|
if ($this->getNewValue()) {
|
|
return pht(
|
|
'%s cancelled this event.',
|
|
$this->renderAuthor());
|
|
} else {
|
|
return pht(
|
|
'%s reinstated this event.',
|
|
$this->renderAuthor());
|
|
}
|
|
}
|
|
|
|
public function getTitleForFeed() {
|
|
if ($this->getNewValue()) {
|
|
return pht(
|
|
'%s cancelled %s.',
|
|
$this->renderAuthor(),
|
|
$this->renderObject());
|
|
} else {
|
|
return pht(
|
|
'%s reinstated %s.',
|
|
$this->renderAuthor(),
|
|
$this->renderObject());
|
|
}
|
|
}
|
|
|
|
}
|