@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Pass "object" to modular transaction methods explicitly

Summary:
Ref T13682. When editing a comment, the edit pathway may invoke file PHID extraction without first formalizing an object on the Editor.

Pass the "object" explicitly to generally improve the robustness of this pathway.

Test Plan: Edited a comment.

Maniphest Tasks: T13682

Differential Revision: https://secure.phabricator.com/D21839

+27 -21
+27 -21
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 398 398 $new = $xaction->getNewValue(); 399 399 400 400 $type = $xaction->getTransactionType(); 401 - $xtype = $this->getModularTransactionType($type); 401 + $xtype = $this->getModularTransactionType($object, $type); 402 402 if ($xtype) { 403 403 $xtype = clone $xtype; 404 404 $xtype->setStorage($xaction); ··· 493 493 494 494 $type = $xaction->getTransactionType(); 495 495 496 - $xtype = $this->getModularTransactionType($type); 496 + $xtype = $this->getModularTransactionType($object, $type); 497 497 if ($xtype) { 498 498 $xtype = clone $xtype; 499 499 $xtype->setStorage($xaction); ··· 591 591 592 592 $type = $xaction->getTransactionType(); 593 593 594 - $xtype = $this->getModularTransactionType($type); 594 + $xtype = $this->getModularTransactionType($object, $type); 595 595 if ($xtype) { 596 596 $xtype = clone $xtype; 597 597 $xtype->setStorage($xaction); ··· 712 712 } 713 713 714 714 $type = $xaction->getTransactionType(); 715 - $xtype = $this->getModularTransactionType($type); 715 + $xtype = $this->getModularTransactionType($object, $type); 716 716 if ($xtype) { 717 717 return $xtype->getTransactionHasEffect( 718 718 $object, ··· 745 745 746 746 $type = $xaction->getTransactionType(); 747 747 748 - $xtype = $this->getModularTransactionType($type); 748 + $xtype = $this->getModularTransactionType($object, $type); 749 749 if ($xtype) { 750 750 $xtype = clone $xtype; 751 751 $xtype->setStorage($xaction); ··· 783 783 784 784 $type = $xaction->getTransactionType(); 785 785 786 - $xtype = $this->getModularTransactionType($type); 786 + $xtype = $this->getModularTransactionType($object, $type); 787 787 if ($xtype) { 788 788 $xtype = clone $xtype; 789 789 $xtype->setStorage($xaction); ··· 1120 1120 continue; 1121 1121 } 1122 1122 1123 - $xtype = $this->getModularTransactionType($type); 1123 + $xtype = $this->getModularTransactionType($object, $type); 1124 1124 if (!$xtype) { 1125 1125 continue; 1126 1126 } ··· 1861 1861 foreach ($xactions as $xaction) { 1862 1862 $type = $xaction->getTransactionType(); 1863 1863 1864 - $xtype = $this->getModularTransactionType($type); 1864 + $xtype = $this->getModularTransactionType($object, $type); 1865 1865 if (!$xtype) { 1866 1866 $capabilities = $this->getLegacyRequiredCapabilities($xaction); 1867 1867 } else { ··· 2136 2136 PhabricatorApplicationTransaction $u, 2137 2137 PhabricatorApplicationTransaction $v) { 2138 2138 2139 + $object = $this->object; 2139 2140 $type = $u->getTransactionType(); 2140 2141 2141 - $xtype = $this->getModularTransactionType($type); 2142 + $xtype = $this->getModularTransactionType($object, $type); 2142 2143 if ($xtype) { 2143 - $object = $this->object; 2144 2144 return $xtype->mergeTransactions($object, $u, $v); 2145 2145 } 2146 2146 ··· 2866 2866 2867 2867 $errors = array(); 2868 2868 2869 - $xtype = $this->getModularTransactionType($type); 2869 + $xtype = $this->getModularTransactionType($object, $type); 2870 2870 if ($xtype) { 2871 2871 $errors[] = $xtype->validateTransactions($object, $xactions); 2872 2872 } ··· 4009 4009 4010 4010 private function getMailDiffSectionHeader($xaction) { 4011 4011 $type = $xaction->getTransactionType(); 4012 + $object = $this->object; 4012 4013 4013 - $xtype = $this->getModularTransactionType($type); 4014 + $xtype = $this->getModularTransactionType($object, $type); 4014 4015 if ($xtype) { 4015 4016 return $xtype->getMailDiffSectionHeader(); 4016 4017 } ··· 4408 4409 foreach ($xactions as $xaction) { 4409 4410 $type = $xaction->getTransactionType(); 4410 4411 4411 - $xtype = $this->getModularTransactionType($type); 4412 + $xtype = $this->getModularTransactionType($object, $type); 4412 4413 if ($xtype) { 4413 4414 $phids[] = $xtype->extractFilePHIDs($object, $xaction->getNewValue()); 4414 4415 } else { ··· 4954 4955 $proxy_phids); 4955 4956 } 4956 4957 4957 - private function getModularTransactionTypes() { 4958 + private function getModularTransactionTypes( 4959 + PhabricatorLiskDAO $object) { 4960 + 4958 4961 if ($this->modularTypes === null) { 4959 - $template = $this->object->getApplicationTransactionTemplate(); 4962 + $template = $object->getApplicationTransactionTemplate(); 4960 4963 if ($template instanceof PhabricatorModularTransaction) { 4961 4964 $xtypes = $template->newModularTransactionTypes(); 4962 4965 foreach ($xtypes as $key => $xtype) { ··· 4974 4977 return $this->modularTypes; 4975 4978 } 4976 4979 4977 - private function getModularTransactionType($type) { 4978 - $types = $this->getModularTransactionTypes(); 4980 + private function getModularTransactionType($object, $type) { 4981 + $types = $this->getModularTransactionTypes($object); 4979 4982 return idx($types, $type); 4980 4983 } 4981 4984 ··· 5535 5538 foreach ($xactions as $xaction) { 5536 5539 $type = $xaction->getTransactionType(); 5537 5540 5538 - $xtype = $this->getModularTransactionType($type); 5541 + $xtype = $this->getModularTransactionType($object, $type); 5539 5542 if ($xtype) { 5540 5543 $xtype = clone $xtype; 5541 5544 $xtype->setStorage($xaction); ··· 5582 5585 private function getTitleForTextMail( 5583 5586 PhabricatorApplicationTransaction $xaction) { 5584 5587 $type = $xaction->getTransactionType(); 5588 + $object = $this->object; 5585 5589 5586 - $xtype = $this->getModularTransactionType($type); 5590 + $xtype = $this->getModularTransactionType($object, $type); 5587 5591 if ($xtype) { 5588 5592 $xtype = clone $xtype; 5589 5593 $xtype->setStorage($xaction); ··· 5599 5603 private function getTitleForHTMLMail( 5600 5604 PhabricatorApplicationTransaction $xaction) { 5601 5605 $type = $xaction->getTransactionType(); 5606 + $object = $this->object; 5602 5607 5603 - $xtype = $this->getModularTransactionType($type); 5608 + $xtype = $this->getModularTransactionType($object, $type); 5604 5609 if ($xtype) { 5605 5610 $xtype = clone $xtype; 5606 5611 $xtype->setStorage($xaction); ··· 5617 5622 private function getBodyForTextMail( 5618 5623 PhabricatorApplicationTransaction $xaction) { 5619 5624 $type = $xaction->getTransactionType(); 5625 + $object = $this->object; 5620 5626 5621 - $xtype = $this->getModularTransactionType($type); 5627 + $xtype = $this->getModularTransactionType($object, $type); 5622 5628 if ($xtype) { 5623 5629 $xtype = clone $xtype; 5624 5630 $xtype->setStorage($xaction);