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

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
This commit is contained in:
epriestley 2019-03-22 09:32:13 -07:00
parent 930cc7a6dd
commit b081053e26
2 changed files with 21 additions and 2 deletions

View file

@ -608,6 +608,7 @@ abstract class PhabricatorController extends AphrontController {
$this->setCurrentApplication($application);
$controller = new LegalpadDocumentSignController();
$controller->setIsSessionGate(true);
return $this->delegateToController($controller);
}

View file

@ -2,6 +2,8 @@
final class LegalpadDocumentSignController extends LegalpadController {
private $isSessionGate;
public function shouldAllowPublic() {
return true;
}
@ -10,6 +12,15 @@ final class LegalpadDocumentSignController extends LegalpadController {
return true;
}
public function setIsSessionGate($is_session_gate) {
$this->isSessionGate = $is_session_gate;
return $this;
}
public function getIsSessionGate() {
return $this->isSessionGate;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getUser();
@ -251,8 +262,14 @@ final class LegalpadDocumentSignController extends LegalpadController {
$header = id(new PHUIHeaderView())
->setHeader($title)
->setUser($viewer)
->setEpoch($content_updated)
->addActionLink(
->setEpoch($content_updated);
// If we're showing the user this document because it's required to use
// Phabricator and they haven't signed it, don't show the "Manage" button,
// since it won't work.
$is_gate = $this->getIsSessionGate();
if (!$is_gate) {
$header->addActionLink(
id(new PHUIButtonView())
->setTag('a')
->setIcon('fa-pencil')
@ -260,6 +277,7 @@ final class LegalpadDocumentSignController extends LegalpadController {
->setHref($manage_uri)
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
}
$preamble_box = null;
if (strlen($document->getPreamble())) {