Page MenuHomePhabricator

D8298.id19736.diff
No OneTemporary

D8298.id19736.diff

diff --git a/src/applications/files/controller/PhabricatorFileListController.php b/src/applications/files/controller/PhabricatorFileListController.php
--- a/src/applications/files/controller/PhabricatorFileListController.php
+++ b/src/applications/files/controller/PhabricatorFileListController.php
@@ -78,7 +78,8 @@
$list_view->addItem($item);
}
- $list_view->appendChild(new PhabricatorGlobalUploadTargetView());
+ $list_view->appendChild(id(new PhabricatorGlobalUploadTargetView())
+ ->setViewer($user));
return $list_view;
}
diff --git a/src/applications/files/controller/PhabricatorFileUploadController.php b/src/applications/files/controller/PhabricatorFileUploadController.php
--- a/src/applications/files/controller/PhabricatorFileUploadController.php
+++ b/src/applications/files/controller/PhabricatorFileUploadController.php
@@ -65,6 +65,7 @@
$title = pht('Upload File');
$global_upload = id(new PhabricatorGlobalUploadTargetView())
+ ->setViewer($user)
->setShowIfSupportedID($support_id);
$form_box = id(new PHUIObjectBoxView())
diff --git a/src/applications/files/view/PhabricatorGlobalUploadTargetView.php b/src/applications/files/view/PhabricatorGlobalUploadTargetView.php
--- a/src/applications/files/view/PhabricatorGlobalUploadTargetView.php
+++ b/src/applications/files/view/PhabricatorGlobalUploadTargetView.php
@@ -2,8 +2,18 @@
final class PhabricatorGlobalUploadTargetView extends AphrontView {
+ private $viewer;
private $showIfSupportedID;
+ public function setViewer(PhabricatorUser $viewer) {
+ $this->viewer = $viewer;
+ return $this;
+ }
+
+ public function getViewer() {
+ return $this->viewer;
+ }
+
public function setShowIfSupportedID($show_if_supported_id) {
$this->showIfSupportedID = $show_if_supported_id;
return $this;
@@ -14,6 +24,12 @@
}
public function render() {
+
+ $viewer = $this->getViewer();
+ if (!$viewer->isLoggedIn()) {
+ return null;
+ }
+
$instructions_id = celerity_generate_unique_node_id();
require_celerity_resource('global-drag-and-drop-css');
diff --git a/src/applications/home/controller/PhabricatorHomeMainController.php b/src/applications/home/controller/PhabricatorHomeMainController.php
--- a/src/applications/home/controller/PhabricatorHomeMainController.php
+++ b/src/applications/home/controller/PhabricatorHomeMainController.php
@@ -75,8 +75,10 @@
$this->minipanels,
);
+ $user = $this->getRequest()->getUser();
$nav->appendChild($content);
- $nav->appendChild(new PhabricatorGlobalUploadTargetView());
+ $nav->appendChild(id(new PhabricatorGlobalUploadTargetView())
+ ->setViewer($user));
return $this->buildApplicationPage(
$nav,

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 1, 10:28 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6756465
Default Alt Text
D8298.id19736.diff (2 KB)

Event Timeline