diff --git a/src/applications/maniphest/storage/ManiphestTransaction.php b/src/applications/maniphest/storage/ManiphestTransaction.php --- a/src/applications/maniphest/storage/ManiphestTransaction.php +++ b/src/applications/maniphest/storage/ManiphestTransaction.php @@ -987,4 +987,13 @@ return parent::getNoEffectDescription(); } + public function shouldRenderBeneathComments() { + switch ($this->getTransactionType()) { + case self::TYPE_STATUS: + return true; + } + + return parent::shouldRenderBeneathComments(); + } + } diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -667,6 +667,10 @@ return $this->shouldHide(); } + public function shouldRenderBeneathComments() { + return false; + } + public function getTitleForMail() { return id(clone $this)->setRenderingTarget('text')->getTitle(); } diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php --- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php @@ -382,6 +382,34 @@ $groups[] = $group; } + $adjusted_groups = array(); + foreach ($groups as $group) { + $has_comment = false; + $attachments = array(); + $comment_type = PhabricatorTransactions::TYPE_COMMENT; + foreach ($group as $key => $xaction) { + if ($xaction->getTransactionType() == $comment_type) { + $has_comment = true; + } + if ($xaction->shouldRenderBeneathComments()) { + $attachments[$key] = $xaction; + } + } + + if ($has_comment) { + foreach ($attachments as $key => $attachment) { + unset($group[$key]); + } + $adjusted_groups[] = $group; + foreach ($attachments as $attachment) { + $adjusted_groups[] = array($attachment); + } + } else { + $adjusted_groups[] = $group; + } + } + $groups = $adjusted_groups; + foreach ($groups as $key => $group) { $results = array();