1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 13:22:42 +01:00

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
This commit is contained in:
epriestley 2015-08-31 10:17:30 -07:00
parent 506168c307
commit 51c52f50fd

View file

@ -211,6 +211,7 @@ final class PHUIDiffInlineCommentDetailView
->addSigil('differential-inline-next')
->setMustCapture(true);
if ($this->canHide()) {
$hide = id(new PHUIButtonView())
->setTag('a')
->setTooltip(pht('Hide Comment'))
@ -218,7 +219,6 @@ final class PHUIDiffInlineCommentDetailView
->addSigil('hide-inline')
->setMustCapture(true);
if ($viewer_phid && $inline->getID() && $inline->supportsHiding()) {
$nextprev->addButton($hide);
}
@ -456,4 +456,27 @@ final class PHUIDiffInlineCommentDetailView
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;
}
}