diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php --- a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php +++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php @@ -211,14 +211,14 @@ ->addSigil('differential-inline-next') ->setMustCapture(true); - $hide = id(new PHUIButtonView()) - ->setTag('a') - ->setTooltip(pht('Hide Comment')) - ->setIconFont('fa-times') - ->addSigil('hide-inline') - ->setMustCapture(true); + if ($this->canHide()) { + $hide = id(new PHUIButtonView()) + ->setTag('a') + ->setTooltip(pht('Hide Comment')) + ->setIconFont('fa-times') + ->addSigil('hide-inline') + ->setMustCapture(true); - if ($viewer_phid && $inline->getID() && $inline->supportsHiding()) { $nextprev->addButton($hide); } @@ -456,4 +456,27 @@ return $markup; } + private function canHide() { + $inline = $this->inlineComment; + + if ($inline->isDraft()) { + return false; + } + + if (!$inline->getID()) { + return false; + } + + $viewer = $this->getUser(); + if (!$viewer->isLoggedIn()) { + return false; + } + + if (!$inline->supportsHiding()) { + return false; + } + + return true; + } + }