diff --git a/src/applications/differential/storage/DifferentialTransactionComment.php b/src/applications/differential/storage/DifferentialTransactionComment.php --- a/src/applications/differential/storage/DifferentialTransactionComment.php +++ b/src/applications/differential/storage/DifferentialTransactionComment.php @@ -144,4 +144,16 @@ 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 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -127,15 +127,12 @@ } 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 --- a/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php @@ -107,6 +107,18 @@ $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 )----------------------------------------- */