Page MenuHomePhabricator

D8142.id18420.diff
No OneTemporary

D8142.id18420.diff

diff --git a/src/applications/differential/editor/DifferentialRevisionEditor.php b/src/applications/differential/editor/DifferentialRevisionEditor.php
--- a/src/applications/differential/editor/DifferentialRevisionEditor.php
+++ b/src/applications/differential/editor/DifferentialRevisionEditor.php
@@ -256,6 +256,7 @@
$adapter->setExplicitCCs($new['ccs']);
$adapter->setExplicitReviewers($new['rev']);
$adapter->setForbiddenCCs($revision->loadUnsubscribedPHIDs());
+ $adapter->setIsNewObject($is_new);
$xscript = HeraldEngine::loadAndApplyRules($adapter);
$xscript_uri = '/herald/transcript/'.$xscript->getID().'/';
diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php
--- a/src/applications/herald/adapter/HeraldAdapter.php
+++ b/src/applications/herald/adapter/HeraldAdapter.php
@@ -38,6 +38,7 @@
const FIELD_BRANCHES = 'branches';
const FIELD_AUTHOR_RAW = 'author-raw';
const FIELD_COMMITTER_RAW = 'committer-raw';
+ const FIELD_IS_NEW_OBJECT = 'new-object';
const CONDITION_CONTAINS = 'contains';
const CONDITION_NOT_CONTAINS = '!contains';
@@ -90,6 +91,7 @@
const VALUE_BUILD_PLAN = 'buildplan';
private $contentSource;
+ private $isNewObject;
public function setContentSource(PhabricatorContentSource $content_source) {
$this->contentSource = $content_source;
@@ -99,6 +101,18 @@
return $this->contentSource;
}
+ public function getIsNewObject() {
+ if (is_bool($this->isNewObject)) {
+ return $this->isNewObject;
+ }
+
+ throw new Exception(pht('You must setIsNewObject to a boolean first!'));
+ }
+ public function setIsNewObject($new) {
+ $this->isNewObject = (bool) $new;
+ return $this;
+ }
+
abstract public function getPHID();
abstract public function getHeraldName();
@@ -110,6 +124,8 @@
return $this->getContentSource()->getSource();
case self::FIELD_ALWAYS:
return true;
+ case self::FIELD_IS_NEW_OBJECT:
+ return $this->getIsNewObject();
default:
throw new Exception(
"Unknown field '{$field_name}'!");
@@ -216,6 +232,7 @@
self::FIELD_BRANCHES => pht('Commit\'s branches'),
self::FIELD_AUTHOR_RAW => pht('Raw author name'),
self::FIELD_COMMITTER_RAW => pht('Raw committer name'),
+ self::FIELD_IS_NEW_OBJECT => pht('Is newly created?'),
);
}
@@ -345,6 +362,7 @@
);
case self::FIELD_IS_MERGE_COMMIT:
case self::FIELD_DIFF_ENORMOUS:
+ case self::FIELD_IS_NEW_OBJECT:
return array(
self::CONDITION_IS_TRUE,
self::CONDITION_IS_FALSE,
diff --git a/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php b/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
--- a/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
+++ b/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
@@ -72,6 +72,7 @@
self::FIELD_RULE,
self::FIELD_AFFECTED_PACKAGE,
self::FIELD_AFFECTED_PACKAGE_OWNER,
+ self::FIELD_OBJECT_IS_NEW,
),
parent::getFields());
}
diff --git a/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php b/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
--- a/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
+++ b/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
@@ -80,6 +80,7 @@
self::FIELD_CC,
self::FIELD_CONTENT_SOURCE,
self::FIELD_PROJECTS,
+ self::FIELD_IS_NEW_OBJECT,
),
parent::getFields());
}
diff --git a/src/applications/herald/adapter/HeraldPholioMockAdapter.php b/src/applications/herald/adapter/HeraldPholioMockAdapter.php
--- a/src/applications/herald/adapter/HeraldPholioMockAdapter.php
+++ b/src/applications/herald/adapter/HeraldPholioMockAdapter.php
@@ -59,6 +59,7 @@
self::FIELD_BODY,
self::FIELD_AUTHOR,
self::FIELD_CC,
+ self::FIELD_OBJECT_IS_NEW,
),
parent::getFields());
}
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -1554,6 +1554,7 @@
$adapter = $this->buildHeraldAdapter($object, $xactions);
$adapter->setContentSource($this->getContentSource());
+ $adapter->setIsNewObject($this->getIsNewObject());
$xscript = HeraldEngine::loadAndApplyRules($adapter);
$this->setHeraldAdapter($adapter);

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 18, 7:51 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6728505
Default Alt Text
D8142.id18420.diff (4 KB)

Event Timeline