Simplify policy header implementation
Summary: Instead of rendering this in all callers, just pass the object into the header and let it figure out how to format it. Test Plan: Looked at Legalpad, Paste, and Pholio. Reviewers: chad, btrahan Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D7039
This commit is contained in:
@@ -32,15 +32,10 @@ final class DivinerBookController extends DivinerController {
|
||||
->setName($book->getShortTitle())
|
||||
->setHref('/book/'.$book->getName().'/'));
|
||||
|
||||
$policies = PhabricatorPolicyQuery::renderPolicyDescriptions(
|
||||
$viewer,
|
||||
$book,
|
||||
true);
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($book->getTitle())
|
||||
->addProperty(PHUIHeaderView::PROPERTY_POLICY,
|
||||
$policies[PhabricatorPolicyCapability::CAN_VIEW]);
|
||||
->setUser($viewer)
|
||||
->setPolicyObject($book);
|
||||
|
||||
$document = new PHUIDocumentView();
|
||||
$document->setHeader($header);
|
||||
|
||||
Reference in New Issue
Block a user