mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 21:32:43 +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,6 +211,7 @@ final class PHUIDiffInlineCommentDetailView
|
||||||
->addSigil('differential-inline-next')
|
->addSigil('differential-inline-next')
|
||||||
->setMustCapture(true);
|
->setMustCapture(true);
|
||||||
|
|
||||||
|
if ($this->canHide()) {
|
||||||
$hide = id(new PHUIButtonView())
|
$hide = id(new PHUIButtonView())
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setTooltip(pht('Hide Comment'))
|
->setTooltip(pht('Hide Comment'))
|
||||||
|
@ -218,7 +219,6 @@ final class PHUIDiffInlineCommentDetailView
|
||||||
->addSigil('hide-inline')
|
->addSigil('hide-inline')
|
||||||
->setMustCapture(true);
|
->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