mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-11 16:16:14 +01:00
cb98b60033
Summary: See PHI197. Populates "status" transactions and a few other obvious types where there's no security/performance/payload/formatting issue I can come up with. The names here are the same as the names for editing with `maniphest.edit`. Test Plan: Used `transaction.search` to retrieve transactions of all new types. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D18761
84 lines
1.9 KiB
PHP
84 lines
1.9 KiB
PHP
<?php
|
|
|
|
final class DifferentialRevisionStatusTransaction
|
|
extends DifferentialRevisionTransactionType {
|
|
|
|
const TRANSACTIONTYPE = 'differential.revision.status';
|
|
|
|
public function generateOldValue($object) {
|
|
return $object->getModernRevisionStatus();
|
|
}
|
|
|
|
public function applyInternalEffects($object, $value) {
|
|
$object->setModernRevisionStatus($value);
|
|
}
|
|
|
|
public function getTitle() {
|
|
$status = $this->newStatusObject();
|
|
|
|
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::newForStatus($new);
|
|
}
|
|
|
|
public function getTransactionTypeForConduit($xaction) {
|
|
return 'status';
|
|
}
|
|
|
|
public function getFieldValuesForConduit($xaction, $data) {
|
|
return array(
|
|
'old' => $xaction->getOldValue(),
|
|
'new' => $xaction->getNewValue(),
|
|
);
|
|
}
|
|
|
|
}
|