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:
parent
506168c307
commit
51c52f50fd
1 changed files with 30 additions and 7 deletions
|
@ -211,14 +211,14 @@ final class PHUIDiffInlineCommentDetailView
|
||||||
->addSigil('differential-inline-next')
|
->addSigil('differential-inline-next')
|
||||||
->setMustCapture(true);
|
->setMustCapture(true);
|
||||||
|
|
||||||
$hide = id(new PHUIButtonView())
|
if ($this->canHide()) {
|
||||||
->setTag('a')
|
$hide = id(new PHUIButtonView())
|
||||||
->setTooltip(pht('Hide Comment'))
|
->setTag('a')
|
||||||
->setIconFont('fa-times')
|
->setTooltip(pht('Hide Comment'))
|
||||||
->addSigil('hide-inline')
|
->setIconFont('fa-times')
|
||||||
->setMustCapture(true);
|
->addSigil('hide-inline')
|
||||||
|
->setMustCapture(true);
|
||||||
|
|
||||||
if ($viewer_phid && $inline->getID() && $inline->supportsHiding()) {
|
|
||||||
$nextprev->addButton($hide);
|
$nextprev->addButton($hide);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,4 +456,27 @@ final class PHUIDiffInlineCommentDetailView
|
||||||
return $markup;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue