Skip to content

Commit 51c52f5

Browse files
author
epriestley
committed
Prevent users from hiding unpublished inlines
Summary: Fixes T9135. This is (probably) never intended and can be confusing. Test Plan: Saw no hide button on unpublished inlines. Saw hide button on published inlines. Clicked hide button. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9135 Differential Revision: https://secure.phabricator.com/D14014
1 parent 506168c commit 51c52f5

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ public function render() {
211211
->addSigil('differential-inline-next')
212212
->setMustCapture(true);
213213

214-
$hide = id(new PHUIButtonView())
215-
->setTag('a')
216-
->setTooltip(pht('Hide Comment'))
217-
->setIconFont('fa-times')
218-
->addSigil('hide-inline')
219-
->setMustCapture(true);
214+
if ($this->canHide()) {
215+
$hide = id(new PHUIButtonView())
216+
->setTag('a')
217+
->setTooltip(pht('Hide Comment'))
218+
->setIconFont('fa-times')
219+
->addSigil('hide-inline')
220+
->setMustCapture(true);
220221

221-
if ($viewer_phid && $inline->getID() && $inline->supportsHiding()) {
222222
$nextprev->addButton($hide);
223223
}
224224

@@ -456,4 +456,27 @@ public function render() {
456456
return $markup;
457457
}
458458

459+
private function canHide() {
460+
$inline = $this->inlineComment;
461+
462+
if ($inline->isDraft()) {
463+
return false;
464+
}
465+
466+
if (!$inline->getID()) {
467+
return false;
468+
}
469+
470+
$viewer = $this->getUser();
471+
if (!$viewer->isLoggedIn()) {
472+
return false;
473+
}
474+
475+
if (!$inline->supportsHiding()) {
476+
return false;
477+
}
478+
479+
return true;
480+
}
481+
459482
}

0 commit comments

Comments
 (0)