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

File list now shows only files which are explicitly uploaded

Summary: Added explicit tags to files which are explicitly uploaded. Fixes T2749

Test Plan: Tested by checking out the files application.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2749

Differential Revision: https://secure.phabricator.com/D5406
This commit is contained in:
Afaque Hussain 2013-03-22 04:59:50 -07:00 committed by epriestley
parent cff9843859
commit 0c2147336c
5 changed files with 16 additions and 0 deletions

View file

@ -18,6 +18,7 @@ final class PhabricatorFileDropUploadController
array(
'name' => $request->getStr('name'),
'authorPHID' => $user->getPHID(),
'isExplicitUpload' => true,
));
$view = new AphrontAttachedFileView();

View file

@ -30,6 +30,7 @@ final class PhabricatorFileListController extends PhabricatorFileController {
switch ($this->getFilter()) {
case 'my':
$query->withAuthorPHIDs(array($user->getPHID()));
$query->showOnlyExplicitUploads(true);
$header = pht('Files You Uploaded');
break;
case 'all':

View file

@ -18,6 +18,7 @@ final class PhabricatorFileUploadController extends PhabricatorFileController {
array(
'name' => $request->getStr('name'),
'authorPHID' => $user->getPHID(),
'isExplicitUpload' => true,
));
}

View file

@ -6,6 +6,7 @@ final class PhabricatorFileQuery
private $ids;
private $phids;
private $authorPHIDs;
private $explicitUploads;
public function withIDs(array $ids) {
$this->ids = $ids;
@ -22,6 +23,11 @@ final class PhabricatorFileQuery
return $this;
}
public function showOnlyExplicitUploads($explicit_uploads) {
$this->explicitUploads = $explicit_uploads;
return $this;
}
protected function loadPage() {
$table = new PhabricatorFile();
$conn_r = $table->establishConnection('r');
@ -63,6 +69,12 @@ final class PhabricatorFileQuery
$this->authorPHIDs);
}
if ($this->explicitUploads) {
$where[] = qsprintf(
$conn_r,
'isExplicitUpload = true');
}
return $this->formatWhereClause($where);
}

View file

@ -247,6 +247,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
// TODO: This is probably YAGNI, but allows for us to do encryption or
// compression later if we want.
$file->setStorageFormat(self::STORAGE_FORMAT_RAW);
$file->setIsExplicitUpload(idx($params, 'isExplicitUpload') ? 1 : 0);
if (isset($params['mime-type'])) {
$file->setMimeType($params['mime-type']);