Differential D19864 Diff 47441 src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php
| Show All 30 Lines | class PhabricatorApplicationTransactionFeedStory | ||||
| protected function getPrimaryTransactionPHID() { | protected function getPrimaryTransactionPHID() { | ||||
| if ($this->primaryTransactionPHID === null) { | if ($this->primaryTransactionPHID === null) { | ||||
| // Transactions are filtered and sorted before they're stored, but the | // Transactions are filtered and sorted before they're stored, but the | ||||
| // rendering logic can change between the time an edit occurs and when | // rendering logic can change between the time an edit occurs and when | ||||
| // we actually render the story. Recalculate the filtering at display | // we actually render the story. Recalculate the filtering at display | ||||
| // time because it's cheap and gets us better results when things change | // time because it's cheap and gets us better results when things change | ||||
| // by letting the changes apply retroactively. | // by letting the changes apply retroactively. | ||||
| $xaction_phids = $this->getValue('transactionPHIDs'); | $xactions = $this->getTransactions(); | ||||
| $xactions = array(); | |||||
| foreach ($xaction_phids as $xaction_phid) { | |||||
| $xactions[] = $this->getObject($xaction_phid); | |||||
| } | |||||
| foreach ($xactions as $key => $xaction) { | foreach ($xactions as $key => $xaction) { | ||||
| if ($xaction->shouldHideForFeed()) { | if ($xaction->shouldHideForFeed()) { | ||||
| unset($xactions[$key]); | unset($xactions[$key]); | ||||
| } | } | ||||
| } | } | ||||
| if ($xactions) { | if ($xactions) { | ||||
| $primary_phid = head($xactions)->getPHID(); | $primary_phid = head($xactions)->getPHID(); | ||||
| } else { | } else { | ||||
| $primary_phid = head($xaction_phids); | $primary_phid = head($this->getValue('transactionPHIDs')); | ||||
| } | } | ||||
| $this->primaryTransactionPHID = $primary_phid; | $this->primaryTransactionPHID = $primary_phid; | ||||
| } | } | ||||
| return $this->primaryTransactionPHID; | return $this->primaryTransactionPHID; | ||||
| } | } | ||||
| public function isVisibleInNotifications() { | |||||
| $xactions = $this->getTransactions(); | |||||
| foreach ($xactions as $key => $xaction) { | |||||
| if (!$xaction->shouldHideForNotifications()) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| public function isVisibleInFeed() { | |||||
| $xactions = $this->getTransactions(); | |||||
| foreach ($xactions as $key => $xaction) { | |||||
| if (!$xaction->shouldHideForFeed()) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| private function getTransactions() { | |||||
| $xaction_phids = $this->getValue('transactionPHIDs'); | |||||
| $xactions = array(); | |||||
| foreach ($xaction_phids as $xaction_phid) { | |||||
| $xactions[] = $this->getObject($xaction_phid); | |||||
| } | |||||
| return $xactions; | |||||
| } | |||||
| public function getPrimaryTransaction() { | public function getPrimaryTransaction() { | ||||
| return $this->getObject($this->getPrimaryTransactionPHID()); | return $this->getObject($this->getPrimaryTransactionPHID()); | ||||
| } | } | ||||
| public function getFieldStoryMarkupFields() { | public function getFieldStoryMarkupFields() { | ||||
| $xaction_phids = $this->getValue('transactionPHIDs'); | $xaction_phids = $this->getValue('transactionPHIDs'); | ||||
| $fields = array(); | $fields = array(); | ||||
| ▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines | |||||