diff --git a/src/applications/differential/storage/DifferentialTransactionComment.php b/src/applications/differential/storage/DifferentialTransactionComment.php index 491d89a968..873aecdd41 100644 --- a/src/applications/differential/storage/DifferentialTransactionComment.php +++ b/src/applications/differential/storage/DifferentialTransactionComment.php @@ -144,4 +144,16 @@ final class DifferentialTransactionComment return $this; } + + public function isEmptyComment() { + if (!parent::isEmptyComment()) { + return false; + } + + return $this->newInlineCommentObject() + ->getContentState() + ->isEmptyContentState(); + } + + } diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index b815354d11..95ef1de6c3 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -127,15 +127,12 @@ abstract class PhabricatorApplicationTransaction } public function hasComment() { - if (!$this->getComment()) { + $comment = $this->getComment(); + if (!$comment) { return false; } - $content = $this->getComment()->getContent(); - - // If the content is empty or consists of only whitespace, don't count - // this as comment. - if (!strlen(trim($content))) { + if ($comment->isEmptyComment()) { return false; } diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php b/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php index 896b45556a..00cad18d2d 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php @@ -107,6 +107,18 @@ abstract class PhabricatorApplicationTransactionComment $this->getTransactionPHID()); } + public function isEmptyComment() { + $content = $this->getContent(); + + // The comment is empty if there's no content, or if the content only has + // whitespace. + if (!strlen(trim($content))) { + return true; + } + + return false; + } + /* -( PhabricatorMarkupInterface )----------------------------------------- */