Page MenuHomePhabricator

D15085.id36559.diff
No OneTemporary

D15085.id36559.diff

diff --git a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
@@ -206,6 +206,7 @@
'statusName' =>
ArcanistDifferentialRevisionStatus::getNameForRevisionStatus(
$revision->getStatus()),
+ 'properties' => $revision->getProperties(),
'branch' => $diff->getBranch(),
'summary' => $revision->getSummary(),
'testPlan' => $revision->getTestPlan(),
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -181,6 +181,7 @@
$status_revision = ArcanistDifferentialRevisionStatus::NEEDS_REVISION;
$status_plan = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED;
$status_abandoned = ArcanistDifferentialRevisionStatus::ABANDONED;
+ $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
switch ($xaction->getTransactionType()) {
case DifferentialTransaction::TYPE_INLINE:
@@ -233,6 +234,11 @@
return;
case DifferentialAction::ACTION_CLOSE:
$object->setStatus(ArcanistDifferentialRevisionStatus::CLOSED);
+ $c = $xaction->getOldValue();
+ $was_accepted = ($xaction->getOldValue() == $status_accepted);
+ var_dump($xaction->getOldValue());
+ throw new Exception("revision old status: __xz__. ${c} __zx__");
+ $object->setProperty('wasAcceptedBeforeClose', $was_accepted);
return;
case DifferentialAction::ACTION_CLAIM:
$object->setAuthorPHID($this->getActingAsPHID());
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -34,6 +34,15 @@
protected $repositoryPHID;
protected $viewPolicy = PhabricatorPolicies::POLICY_USER;
protected $editPolicy = PhabricatorPolicies::POLICY_USER;
+ protected $properties = array(); /* // TODO: migration: /*
+ $ cat 20140808.boardprop.1.sql 20140808.boardprop.2.sql
+ ALTER TABLE {$NAMESPACE}_project.project_column
+ ADD properties LONGTEXT NOT NULL COLLATE utf8_bin;
+UPDATE {$NAMESPACE}_project.project_column
+ SET properties = '{}' WHERE properties = '';
+
+
+ */
private $relationships = self::ATTACHABLE;
private $commits = self::ATTACHABLE;
@@ -75,6 +84,7 @@
self::CONFIG_SERIALIZATION => array(
'attached' => self::SERIALIZATION_JSON,
'unsubscribed' => self::SERIALIZATION_JSON,
+ 'properties' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'title' => 'text255',
@@ -113,6 +123,15 @@
) + parent::getConfiguration();
}
+ public function setProperty($key, $value) {
+ $this->properties[$key] = $value;
+ return $this;
+ }
+
+ public function getProperty($key, $default = null) {
+ return idx($this->properties, $key, $default);
+ }
+
public function getMonogram() {
$id = $this->getID();
return "D{$id}";
diff --git a/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php
@@ -19,10 +19,30 @@
return null;
}
+ $status = $revision->getStatus();
+
+ switch ($status) {
+ case ArcanistDifferentialRevisionStatus::ACCEPTED:
+ return $revision->getPHID();
+ case ArcanistDifferentialRevisionStatus::CLOSED:
+ $was_accepted =
+ $revision->getProperty('wasAcceptedBeforeClose', 'undefined');
+ switch ($was_accepted) {
+ case false:
+ return null;
+ case true:
+ return $revision->getPHID();
+ case 'undefined':
+ // continue on to old=style precommitRevisionStatus
+ break;
+ }
+ break;
+ default:
+ return null;
+ }
+
$data = $object->getCommitData();
- $status = $data->getCommitDetail(
- 'precommitRevisionStatus',
- $revision->getStatus());
+ $status = $data->getCommitDetail('precommitRevisionStatus');
switch ($status) {
case ArcanistDifferentialRevisionStatus::ACCEPTED:
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptedHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptedHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptedHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptedHeraldField.php
@@ -20,12 +20,17 @@
return null;
}
- $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
- if ($revision->getStatus() != $status_accepted) {
- return null;
+ switch ($revision->getStatus()) {
+ case ArcanistDifferentialRevisionStatus::ACCEPTED:
+ return $revision->getPHID();
+ case ArcanistDifferentialRevisionStatus::CLOSED:
+ if ($revision->getProperty('wasAcceptedBeforeClose')) {
+ return $revision->getPHID();
+ }
+ break;
}
- return $revision->getPHID();
+ return null;
}
protected function getHeraldFieldStandardType() {

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 10, 11:21 AM (4 d, 10 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6733668
Default Alt Text
D15085.id36559.diff (5 KB)

Event Timeline