Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14038020
D20519.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D20519.id.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D20519: When using the Herald test console on a transactional object, guess a reasonable set of transactions to simulate
Attached
Detach File
Event Timeline
Log In to Comment