diff --git a/src/applications/audit/storage/PhabricatorAuditInlineComment.php b/src/applications/audit/storage/PhabricatorAuditInlineComment.php --- a/src/applications/audit/storage/PhabricatorAuditInlineComment.php +++ b/src/applications/audit/storage/PhabricatorAuditInlineComment.php @@ -111,6 +111,13 @@ $viewer->getPHID()); } + foreach ($inlines as $key => $inline) { + $is_draft = !$inline->getTransactionPHID(); + if ($is_draft && $inline->isEmptyInlineComment()) { + unset($inlines[$key]); + } + } + return self::buildProxies($inlines); } diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -197,6 +197,7 @@ $query = id(new DifferentialInlineCommentQuery()) ->setViewer($viewer) ->needHidden(true) + ->withEmptyInlineComments(false) ->withRevisionPHIDs(array($revision->getPHID())); $inlines = $query->execute(); $inlines = $query->adjustInlinesForChangesets( diff --git a/src/applications/differential/query/DifferentialInlineCommentQuery.php b/src/applications/differential/query/DifferentialInlineCommentQuery.php --- a/src/applications/differential/query/DifferentialInlineCommentQuery.php +++ b/src/applications/differential/query/DifferentialInlineCommentQuery.php @@ -16,6 +16,7 @@ private $revisionPHIDs; private $deletedDrafts; private $needHidden; + private $withEmpty; public function setViewer(PhabricatorUser $viewer) { $this->viewer = $viewer; @@ -61,6 +62,11 @@ return $this; } + public function withEmptyInlineComments($empty) { + $this->withEmpty = $empty; + return $this; + } + public function execute() { $table = new DifferentialTransactionComment(); $conn_r = $table->establishConnection('r'); @@ -74,6 +80,15 @@ $comments = $table->loadAllFromArray($data); + if ($this->withEmpty !== null) { + $want_empty = (bool)$this->withEmpty; + foreach ($comments as $key => $value) { + if ($value->isEmptyInlineComment() !== $want_empty) { + unset($comments[$key]); + } + } + } + if ($this->needHidden) { $viewer_phid = $this->getViewer()->getPHID(); if ($viewer_phid && $comments) {