2017-08-11 23:13:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialRevisionStatusTransaction
|
|
|
|
extends DifferentialRevisionTransactionType {
|
|
|
|
|
|
|
|
const TRANSACTIONTYPE = 'differential.revision.status';
|
|
|
|
|
|
|
|
public function generateOldValue($object) {
|
2017-08-12 01:21:28 +02:00
|
|
|
return $object->getLegacyRevisionStatus();
|
2017-08-11 23:13:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function applyInternalEffects($object, $value) {
|
2017-08-12 01:21:28 +02:00
|
|
|
$object->setLegacyRevisionStatus($value);
|
2017-08-11 23:13:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle() {
|
2017-08-12 01:27:38 +02:00
|
|
|
$status = $this->newStatusObject();
|
2017-08-11 23:13:25 +02:00
|
|
|
|
|
|
|
if ($status->isAccepted()) {
|
|
|
|
return pht('This revision is now accepted and ready to land.');
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($status->isNeedsRevision()) {
|
|
|
|
return pht('This revision now requires changes to proceed.');
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($status->isNeedsReview()) {
|
|
|
|
return pht('This revision now requires review to proceed.');
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitleForFeed() {
|
|
|
|
$status = $this->newStatusObject();
|
|
|
|
|
|
|
|
if ($status->isAccepted()) {
|
|
|
|
return pht(
|
|
|
|
'%s is now accepted and ready to land.',
|
|
|
|
$this->renderObject());
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($status->isNeedsRevision()) {
|
|
|
|
return pht(
|
|
|
|
'%s now requires changes to proceed.',
|
|
|
|
$this->renderObject());
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($status->isNeedsReview()) {
|
|
|
|
return pht(
|
|
|
|
'%s now requires review to proceed.',
|
|
|
|
$this->renderObject());
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIcon() {
|
|
|
|
$status = $this->newStatusObject();
|
|
|
|
return $status->getTimelineIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getColor() {
|
|
|
|
$status = $this->newStatusObject();
|
|
|
|
return $status->getTimelineColor();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function newStatusObject() {
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
return DifferentialRevisionStatus::newForLegacyStatus($new);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|