1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Hide upload JS stuff if user isn't logged in

Summary: ...cuz it won't work. I think adding a "login to upload" has no real value as this is a pretty unexpected / power user feature anyway. Fixes T4354.

Test Plan: tried to upload as a logged out user to Phabricator home. my browser just loaded the file as expected.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4354

Differential Revision: https://secure.phabricator.com/D8298
This commit is contained in:
Bob Trahan 2014-02-21 13:04:23 -08:00
parent a84cc1ab73
commit 2a277bbc03
4 changed files with 11 additions and 2 deletions

View file

@ -78,7 +78,8 @@ final class PhabricatorFileListController extends PhabricatorFileController
$list_view->addItem($item);
}
$list_view->appendChild(new PhabricatorGlobalUploadTargetView());
$list_view->appendChild(id(new PhabricatorGlobalUploadTargetView())
->setUser($user));
return $list_view;
}

View file

@ -65,6 +65,7 @@ final class PhabricatorFileUploadController extends PhabricatorFileController {
$title = pht('Upload File');
$global_upload = id(new PhabricatorGlobalUploadTargetView())
->setUser($user)
->setShowIfSupportedID($support_id);
$form_box = id(new PHUIObjectBoxView())

View file

@ -14,6 +14,11 @@ final class PhabricatorGlobalUploadTargetView extends AphrontView {
}
public function render() {
$viewer = $this->getUser();
if (!$viewer->isLoggedIn()) {
return null;
}
$instructions_id = celerity_generate_unique_node_id();
require_celerity_resource('global-drag-and-drop-css');

View file

@ -75,8 +75,10 @@ final class PhabricatorHomeMainController
$this->minipanels,
);
$user = $this->getRequest()->getUser();
$nav->appendChild($content);
$nav->appendChild(new PhabricatorGlobalUploadTargetView());
$nav->appendChild(id(new PhabricatorGlobalUploadTargetView())
->setUser($user));
return $this->buildApplicationPage(
$nav,