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:57:44 +02:00
|
|
|
return $object->getModernRevisionStatus();
|
2017-08-11 23:13:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function applyInternalEffects($object, $value) {
|
2017-08-12 01:57:44 +02:00
|
|
|
$object->setModernRevisionStatus($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();
|
2017-08-12 01:57:44 +02:00
|
|
|
return DifferentialRevisionStatus::newForStatus($new);
|
2017-08-11 23:13:25 +02:00
|
|
|
}
|
|
|
|
|
Allow ModularTransactions to opt in to providing data to Conduit
Summary:
Ref T5873. See PHI14. I don't want to just expose internal transaction data to Conduit by default, since it's often: unstable, unusable, sensitive, or some combination of the three.
Instead, let ModularTransactions opt in to providing additional data to Conduit, similar to other infrastructure. If a transaction doesn't, the API returns an empty skeleton for it. This is generally fine since most transactions have no real use cases, and I think we can fill them in as we go.
This also probably builds toward T5726, which would likely use the same format, and perhaps simply not publish stuff which did not opt in.
This doesn't actually cover "comment" or "inline comment", which are presumably what PHI14 is after, since neither is modular. I'll probably just put a hack in place for this until they can modularize since I suspect modularizing them here is difficult.
Test Plan: Ran `transaction.search` on a revision, saw some transactions (title and status transactions) populate with values.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T5873
Differential Revision: https://secure.phabricator.com/D18467
2017-08-24 23:40:11 +02:00
|
|
|
public function getTransactionTypeForConduit($xaction) {
|
|
|
|
return 'status';
|
|
|
|
}
|
|
|
|
|
2017-11-06 19:25:37 +01:00
|
|
|
public function getFieldValuesForConduit($xaction, $data) {
|
Allow ModularTransactions to opt in to providing data to Conduit
Summary:
Ref T5873. See PHI14. I don't want to just expose internal transaction data to Conduit by default, since it's often: unstable, unusable, sensitive, or some combination of the three.
Instead, let ModularTransactions opt in to providing additional data to Conduit, similar to other infrastructure. If a transaction doesn't, the API returns an empty skeleton for it. This is generally fine since most transactions have no real use cases, and I think we can fill them in as we go.
This also probably builds toward T5726, which would likely use the same format, and perhaps simply not publish stuff which did not opt in.
This doesn't actually cover "comment" or "inline comment", which are presumably what PHI14 is after, since neither is modular. I'll probably just put a hack in place for this until they can modularize since I suspect modularizing them here is difficult.
Test Plan: Ran `transaction.search` on a revision, saw some transactions (title and status transactions) populate with values.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T5873
Differential Revision: https://secure.phabricator.com/D18467
2017-08-24 23:40:11 +02:00
|
|
|
return array(
|
2017-11-06 19:25:37 +01:00
|
|
|
'old' => $xaction->getOldValue(),
|
|
|
|
'new' => $xaction->getNewValue(),
|
Allow ModularTransactions to opt in to providing data to Conduit
Summary:
Ref T5873. See PHI14. I don't want to just expose internal transaction data to Conduit by default, since it's often: unstable, unusable, sensitive, or some combination of the three.
Instead, let ModularTransactions opt in to providing additional data to Conduit, similar to other infrastructure. If a transaction doesn't, the API returns an empty skeleton for it. This is generally fine since most transactions have no real use cases, and I think we can fill them in as we go.
This also probably builds toward T5726, which would likely use the same format, and perhaps simply not publish stuff which did not opt in.
This doesn't actually cover "comment" or "inline comment", which are presumably what PHI14 is after, since neither is modular. I'll probably just put a hack in place for this until they can modularize since I suspect modularizing them here is difficult.
Test Plan: Ran `transaction.search` on a revision, saw some transactions (title and status transactions) populate with values.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T5873
Differential Revision: https://secure.phabricator.com/D18467
2017-08-24 23:40:11 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-08-11 23:13:25 +02:00
|
|
|
}
|