Page MenuHomePhabricator

D19411.id46432.diff
No OneTemporary

D19411.id46432.diff

diff --git a/src/applications/herald/controller/HeraldTestConsoleController.php b/src/applications/herald/controller/HeraldTestConsoleController.php
--- a/src/applications/herald/controller/HeraldTestConsoleController.php
+++ b/src/applications/herald/controller/HeraldTestConsoleController.php
@@ -38,8 +38,10 @@
$object = $this->getTestObject();
$adapter = $this->getTestAdapter();
+ $source = $this->newContentSource($object);
$adapter
+ ->setContentSource($source)
->setIsNewObject(false)
->setActingAsPHID($viewer->getPHID())
->setViewer($viewer);
@@ -218,4 +220,29 @@
->appendChild($view);
}
+ private function newContentSource($object) {
+ $viewer = $this->getViewer();
+
+ // Try using the content source associated with the most recent transaction
+ // on the object.
+
+ $query = PhabricatorApplicationTransactionQuery::newQueryForObject($object);
+
+ $xaction = $query
+ ->setViewer($viewer)
+ ->withObjectPHIDs(array($object->getPHID()))
+ ->setLimit(1)
+ ->setOrder('newest')
+ ->executeOne();
+ if ($xaction) {
+ return $xaction->getContentSource();
+ }
+
+ // If we couldn't find a transaction (which should be rare), fall back to
+ // building a new content source from the test console request itself.
+
+ $request = $this->getRequest();
+ return PhabricatorContentSource::newFromRequest($request);
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 27, 9:32 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7719022
Default Alt Text
D19411.id46432.diff (1 KB)

Event Timeline