Page MenuHomePhabricator

D20519.id.diff
No OneTemporary

D20519.id.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
@@ -46,6 +46,11 @@
->setActingAsPHID($viewer->getPHID())
->setViewer($viewer);
+ $applied_xactions = $this->loadAppliedTransactions($object);
+ if ($applied_xactions !== null) {
+ $adapter->setAppliedTransactions($applied_xactions);
+ }
+
$rules = id(new HeraldRuleQuery())
->setViewer($viewer)
->withContentTypes(array($adapter->getAdapterContentType()))
@@ -245,4 +250,38 @@
return PhabricatorContentSource::newFromRequest($request);
}
+ private function loadAppliedTransactions($object) {
+ $viewer = $this->getViewer();
+
+ if (!($object instanceof PhabricatorApplicationTransactionInterface)) {
+ return null;
+ }
+
+ $query = PhabricatorApplicationTransactionQuery::newQueryForObject(
+ $object);
+
+ $xactions = $query
+ ->withObjectPHIDs(array($object->getPHID()))
+ ->setViewer($viewer)
+ ->setLimit(100)
+ ->execute();
+
+ $applied = array();
+
+ // Pick the most recent group of transactions. This may not be exactly the
+ // same as what Herald acted on: for example, we may select a single group
+ // of transactions here which were really applied across two or more edits.
+ // Since this is relatively rare and we show you what we picked, it's okay
+ // that we just do roughly the right thing.
+ foreach ($xactions as $xaction) {
+ if (!$xaction->shouldDisplayGroupWith($applied)) {
+ break;
+ }
+ $applied[] = $xaction;
+ }
+
+ return $applied;
+
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 11, 9:02 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6763661
Default Alt Text
D20519.id.diff (1 KB)

Event Timeline