Page MenuHomePhabricator

D8273.diff
No OneTemporary

D8273.diff

Index: src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
===================================================================
--- src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
+++ src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
@@ -120,6 +120,27 @@
return $xactions;
}
+ protected function willFilterPage(array $xactions) {
+ $object_phids = array_keys(mpull($xactions, null, 'getObjectPHID'));
+
+ $objects = id(new PhabricatorObjectQuery())
+ ->setViewer($this->getViewer())
+ ->setParentQuery($this)
+ ->withPHIDs($object_phids)
+ ->execute();
+
+ foreach ($xactions as $key => $xaction) {
+ $object_phid = $xaction->getObjectPHID();
+ if (empty($objects[$object_phid])) {
+ unset($xactions[$key]);
+ continue;
+ }
+ $xaction->attachObject($objects[$object_phid]);
+ }
+
+ return $xactions;
+ }
+
private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
$where = array();
Index: src/applications/transactions/storage/PhabricatorApplicationTransaction.php
===================================================================
--- src/applications/transactions/storage/PhabricatorApplicationTransaction.php
+++ src/applications/transactions/storage/PhabricatorApplicationTransaction.php
@@ -29,6 +29,7 @@
private $renderingTarget = self::TARGET_HTML;
private $transactionGroup = array();
private $viewer = self::ATTACHABLE;
+ private $object = self::ATTACHABLE;
abstract public function getApplicationTransactionType();
@@ -110,6 +111,15 @@
return $this;
}
+ public function attachObject($object) {
+ $this->object = $object;
+ return $this;
+ }
+
+ public function getObject() {
+ return $this->assertAttached($this->object);
+ }
+
/* -( Rendering )---------------------------------------------------------- */
public function setRenderingTarget($rendering_target) {
@@ -388,10 +398,7 @@
case PhabricatorTransactions::TYPE_CUSTOMFIELD:
$key = $this->getMetadataValue('customfield:key');
$field = PhabricatorCustomField::getObjectField(
- // TODO: This is a giant hack, but we currently don't have a way to
- // get the contextual object and this pathway is only hit by
- // Maniphest. We should provide a way to get the actual object here.
- new ManiphestTask(),
+ $this->getObject(),
PhabricatorCustomField::ROLE_APPLICATIONTRANSACTIONS,
$key);
if ($field) {
@@ -455,10 +462,7 @@
case PhabricatorTransactions::TYPE_CUSTOMFIELD:
$key = $this->getMetadataValue('customfield:key');
$field = PhabricatorCustomField::getObjectField(
- // TODO: This is a giant hack, but we currently don't have a way to
- // get the contextual object and this pathway is only hit by
- // Maniphest. We should provide a way to get the actual object here.
- new ManiphestTask(),
+ $this->getObject(),
PhabricatorCustomField::ROLE_APPLICATIONTRANSACTIONS,
$key);
if ($field) {

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 12, 11:13 PM (1 d, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6737302
Default Alt Text
D8273.diff (3 KB)

Event Timeline