@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Don't show a "Manage" button in Legalpad if the user is signing a TOS document

Summary:
When a TOS-like Legalpad document is marked "Require this document to use Phabricator", the login prompt shows a "Manage" button, but that button doesn't work.

When we're presenting a document as a session gate, don't show "Manage".

Test Plan: Viewed a required document during a session gate (no "Manage" button) and normally (saw "Manage" button).

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20312

+21 -2
+1
src/applications/base/controller/PhabricatorController.php
··· 608 608 $this->setCurrentApplication($application); 609 609 610 610 $controller = new LegalpadDocumentSignController(); 611 + $controller->setIsSessionGate(true); 611 612 return $this->delegateToController($controller); 612 613 } 613 614
+20 -2
src/applications/legalpad/controller/LegalpadDocumentSignController.php
··· 2 2 3 3 final class LegalpadDocumentSignController extends LegalpadController { 4 4 5 + private $isSessionGate; 6 + 5 7 public function shouldAllowPublic() { 6 8 return true; 7 9 } 8 10 9 11 public function shouldAllowLegallyNonCompliantUsers() { 10 12 return true; 13 + } 14 + 15 + public function setIsSessionGate($is_session_gate) { 16 + $this->isSessionGate = $is_session_gate; 17 + return $this; 18 + } 19 + 20 + public function getIsSessionGate() { 21 + return $this->isSessionGate; 11 22 } 12 23 13 24 public function handleRequest(AphrontRequest $request) { ··· 251 262 $header = id(new PHUIHeaderView()) 252 263 ->setHeader($title) 253 264 ->setUser($viewer) 254 - ->setEpoch($content_updated) 255 - ->addActionLink( 265 + ->setEpoch($content_updated); 266 + 267 + // If we're showing the user this document because it's required to use 268 + // Phabricator and they haven't signed it, don't show the "Manage" button, 269 + // since it won't work. 270 + $is_gate = $this->getIsSessionGate(); 271 + if (!$is_gate) { 272 + $header->addActionLink( 256 273 id(new PHUIButtonView()) 257 274 ->setTag('a') 258 275 ->setIcon('fa-pencil') ··· 260 277 ->setHref($manage_uri) 261 278 ->setDisabled(!$can_edit) 262 279 ->setWorkflow(!$can_edit)); 280 + } 263 281 264 282 $preamble_box = null; 265 283 if (strlen($document->getPreamble())) {