Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14411688
D13735.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Referenced Files
None
Subscribers
None
D13735.diff
View Options
diff --git a/src/applications/files/controller/PhabricatorFileCommentController.php b/src/applications/files/controller/PhabricatorFileCommentController.php
--- a/src/applications/files/controller/PhabricatorFileCommentController.php
+++ b/src/applications/files/controller/PhabricatorFileCommentController.php
@@ -2,23 +2,17 @@
final class PhabricatorFileCommentController extends PhabricatorFileController {
- private $id;
-
- public function willProcessRequest(array $data) {
- $this->id = idx($data, 'id');
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+ $id = $request->getURIData('id');
if (!$request->isFormPost()) {
return new Aphront400Response();
}
$file = id(new PhabricatorFileQuery())
- ->setViewer($user)
- ->withIDs(array($this->id))
+ ->setViewer($viewer)
+ ->withIDs(array($id))
->executeOne();
if (!$file) {
return new Aphront404Response();
@@ -37,7 +31,7 @@
->setContent($request->getStr('comment')));
$editor = id(new PhabricatorFileEditor())
- ->setActor($user)
+ ->setActor($viewer)
->setContinueOnNoEffect($request->isContinueRequest())
->setContentSourceFromRequest($request)
->setIsPreview($is_preview);
@@ -56,7 +50,7 @@
if ($request->isAjax() && $is_preview) {
return id(new PhabricatorApplicationTransactionResponse())
- ->setViewer($user)
+ ->setViewer($viewer)
->setTransactions($xactions)
->setIsPreview($is_preview);
} else {
diff --git a/src/applications/files/controller/PhabricatorFileComposeController.php b/src/applications/files/controller/PhabricatorFileComposeController.php
--- a/src/applications/files/controller/PhabricatorFileComposeController.php
+++ b/src/applications/files/controller/PhabricatorFileComposeController.php
@@ -3,9 +3,8 @@
final class PhabricatorFileComposeController
extends PhabricatorFileController {
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
$colors = array(
'red' => pht('Verbillion'),
diff --git a/src/applications/files/controller/PhabricatorFileDataController.php b/src/applications/files/controller/PhabricatorFileDataController.php
--- a/src/applications/files/controller/PhabricatorFileDataController.php
+++ b/src/applications/files/controller/PhabricatorFileDataController.php
@@ -7,19 +7,15 @@
private $token;
private $file;
- public function willProcessRequest(array $data) {
- $this->phid = $data['phid'];
- $this->key = $data['key'];
- $this->token = idx($data, 'token');
- }
-
public function shouldRequireLogin() {
return false;
}
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $this->getViewer();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+ $this->phid = $request->getURIData('phid');
+ $this->key = $request->getURIData('key');
+ $this->token = $request->getURIData('token');
$alt = PhabricatorEnv::getEnvConfig('security.alternate-file-domain');
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
diff --git a/src/applications/files/controller/PhabricatorFileDeleteController.php b/src/applications/files/controller/PhabricatorFileDeleteController.php
--- a/src/applications/files/controller/PhabricatorFileDeleteController.php
+++ b/src/applications/files/controller/PhabricatorFileDeleteController.php
@@ -2,19 +2,13 @@
final class PhabricatorFileDeleteController extends PhabricatorFileController {
- private $id;
-
- public function willProcessRequest(array $data) {
- $this->id = $data['id'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+ $id = $request->getURIData('id');
$file = id(new PhabricatorFileQuery())
- ->setViewer($user)
- ->withIDs(array($this->id))
+ ->setViewer($viewer)
+ ->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
@@ -25,8 +19,8 @@
return new Aphront404Response();
}
- if (($user->getPHID() != $file->getAuthorPHID()) &&
- (!$user->getIsAdmin())) {
+ if (($viewer->getPHID() != $file->getAuthorPHID()) &&
+ (!$viewer->getIsAdmin())) {
return new Aphront403Response();
}
@@ -36,7 +30,7 @@
}
$dialog = new AphrontDialogView();
- $dialog->setUser($user);
+ $dialog->setUser($viewer);
$dialog->setTitle(pht('Really delete file?'));
$dialog->appendChild(hsprintf(
'<p>%s</p>',
diff --git a/src/applications/files/controller/PhabricatorFileDropUploadController.php b/src/applications/files/controller/PhabricatorFileDropUploadController.php
--- a/src/applications/files/controller/PhabricatorFileDropUploadController.php
+++ b/src/applications/files/controller/PhabricatorFileDropUploadController.php
@@ -6,9 +6,8 @@
/**
* @phutil-external-symbol class PhabricatorStartup
*/
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
// NOTE: Throws if valid CSRF token is not present in the request.
$request->validateCSRF();
diff --git a/src/applications/files/controller/PhabricatorFileEditController.php b/src/applications/files/controller/PhabricatorFileEditController.php
--- a/src/applications/files/controller/PhabricatorFileEditController.php
+++ b/src/applications/files/controller/PhabricatorFileEditController.php
@@ -2,19 +2,13 @@
final class PhabricatorFileEditController extends PhabricatorFileController {
- private $id;
-
- public function willProcessRequest(array $data) {
- $this->id = $data['id'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+ $id = $request->getURIData('id');
$file = id(new PhabricatorFileQuery())
->setViewer($viewer)
- ->withIDs(array($this->id))
+ ->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
diff --git a/src/applications/files/controller/PhabricatorFileInfoController.php b/src/applications/files/controller/PhabricatorFileInfoController.php
--- a/src/applications/files/controller/PhabricatorFileInfoController.php
+++ b/src/applications/files/controller/PhabricatorFileInfoController.php
@@ -2,26 +2,19 @@
final class PhabricatorFileInfoController extends PhabricatorFileController {
- private $phid;
- private $id;
-
public function shouldAllowPublic() {
return true;
}
- public function willProcessRequest(array $data) {
- $this->phid = idx($data, 'phid');
- $this->id = idx($data, 'id');
- }
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+ $id = $request->getURIData('id');
+ $phid = $request->getURIData('phid');
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
-
- if ($this->phid) {
+ if ($phid) {
$file = id(new PhabricatorFileQuery())
- ->setViewer($user)
- ->withPHIDs(array($this->phid))
+ ->setViewer($viewer)
+ ->withPHIDs(array($phid))
->executeOne();
if (!$file) {
@@ -30,8 +23,8 @@
return id(new AphrontRedirectResponse())->setURI($file->getInfoURI());
}
$file = id(new PhabricatorFileQuery())
- ->setViewer($user)
- ->withIDs(array($this->id))
+ ->setViewer($viewer)
+ ->withIDs(array($id))
->executeOne();
if (!$file) {
return new Aphront404Response();
@@ -40,7 +33,7 @@
$phid = $file->getPHID();
$header = id(new PHUIHeaderView())
- ->setUser($user)
+ ->setUser($viewer)
->setPolicyObject($file)
->setHeader($file->getName());
@@ -87,7 +80,7 @@
}
private function buildTransactionView(PhabricatorFile $file) {
- $user = $this->getRequest()->getUser();
+ $viewer = $this->getViewer();
$timeline = $this->buildTransactionTimeline(
$file,
@@ -99,10 +92,10 @@
? pht('Add Comment')
: pht('Question File Integrity');
- $draft = PhabricatorDraft::newFromUserAndKey($user, $file->getPHID());
+ $draft = PhabricatorDraft::newFromUserAndKey($viewer, $file->getPHID());
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())
- ->setUser($user)
+ ->setUser($viewer)
->setObjectPHID($file->getPHID())
->setDraft($draft)
->setHeaderText($add_comment_header)
@@ -116,8 +109,7 @@
}
private function buildActionView(PhabricatorFile $file) {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ $viewer = $this->getViewer();
$id = $file->getID();
@@ -184,7 +176,7 @@
PhabricatorFile $file,
PhabricatorActionListView $actions) {
$request = $this->getRequest();
- $user = $request->getUser();
+ $viewer = $request->getUser();
$properties = id(new PHUIPropertyListView());
$properties->setActionList($actions);
@@ -193,12 +185,12 @@
if ($file->getAuthorPHID()) {
$properties->addProperty(
pht('Author'),
- $user->renderHandle($file->getAuthorPHID()));
+ $viewer->renderHandle($file->getAuthorPHID()));
}
$properties->addProperty(
pht('Created'),
- phabricator_datetime($file->getDateCreated(), $user));
+ phabricator_datetime($file->getDateCreated(), $viewer));
$finfo = id(new PHUIPropertyListView());
@@ -276,7 +268,7 @@
$attached->addProperty(
pht('Attached To'),
- $user->renderHandleList($phids));
+ $viewer->renderHandleList($phids));
}
if ($file->isViewableImage()) {
@@ -330,7 +322,7 @@
$box->addPropertyList($chunkinfo, pht('Chunks'));
$chunks = id(new PhabricatorFileChunkQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->withChunkHandles(array($file->getStorageHandle()))
->execute();
$chunks = msort($chunks, 'getByteStart');
diff --git a/src/applications/files/controller/PhabricatorFileUploadDialogController.php b/src/applications/files/controller/PhabricatorFileUploadDialogController.php
--- a/src/applications/files/controller/PhabricatorFileUploadDialogController.php
+++ b/src/applications/files/controller/PhabricatorFileUploadDialogController.php
@@ -3,12 +3,11 @@
final class PhabricatorFileUploadDialogController
extends PhabricatorFileController {
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
$dialog = id(new AphrontDialogView())
- ->setUser($user)
+ ->setUser($viewer)
->setTitle(pht('Upload File'))
->appendChild(pht(
'To add files, drag and drop them into the comment text area.'))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 25, 12:09 PM (11 h, 12 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6926149
Default Alt Text
D13735.diff (11 KB)
Attached To
Mode
D13735: Update Files for handleRequest
Attached
Detach File
Event Timeline
Log In to Comment