Skip to content

Commit 0c21473

Browse files
afaquejamepriestley
authored andcommitted
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
1 parent cff9843 commit 0c21473

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

src/applications/files/controller/PhabricatorFileDropUploadController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function processRequest() {
1818
array(
1919
'name' => $request->getStr('name'),
2020
'authorPHID' => $user->getPHID(),
21+
'isExplicitUpload' => true,
2122
));
2223

2324
$view = new AphrontAttachedFileView();

src/applications/files/controller/PhabricatorFileListController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function processRequest() {
3030
switch ($this->getFilter()) {
3131
case 'my':
3232
$query->withAuthorPHIDs(array($user->getPHID()));
33+
$query->showOnlyExplicitUploads(true);
3334
$header = pht('Files You Uploaded');
3435
break;
3536
case 'all':

src/applications/files/controller/PhabricatorFileUploadController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function processRequest() {
1818
array(
1919
'name' => $request->getStr('name'),
2020
'authorPHID' => $user->getPHID(),
21+
'isExplicitUpload' => true,
2122
));
2223
}
2324

src/applications/files/query/PhabricatorFileQuery.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ final class PhabricatorFileQuery
66
private $ids;
77
private $phids;
88
private $authorPHIDs;
9+
private $explicitUploads;
910

1011
public function withIDs(array $ids) {
1112
$this->ids = $ids;
@@ -22,6 +23,11 @@ public function withAuthorPHIDs(array $phids) {
2223
return $this;
2324
}
2425

26+
public function showOnlyExplicitUploads($explicit_uploads) {
27+
$this->explicitUploads = $explicit_uploads;
28+
return $this;
29+
}
30+
2531
protected function loadPage() {
2632
$table = new PhabricatorFile();
2733
$conn_r = $table->establishConnection('r');
@@ -63,6 +69,12 @@ private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
6369
$this->authorPHIDs);
6470
}
6571

72+
if ($this->explicitUploads) {
73+
$where[] = qsprintf(
74+
$conn_r,
75+
'isExplicitUpload = true');
76+
}
77+
6678
return $this->formatWhereClause($where);
6779
}
6880

src/applications/files/storage/PhabricatorFile.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ private static function buildFromFileData($data, array $params = array()) {
247247
// TODO: This is probably YAGNI, but allows for us to do encryption or
248248
// compression later if we want.
249249
$file->setStorageFormat(self::STORAGE_FORMAT_RAW);
250+
$file->setIsExplicitUpload(idx($params, 'isExplicitUpload') ? 1 : 0);
250251

251252
if (isset($params['mime-type'])) {
252253
$file->setMimeType($params['mime-type']);

0 commit comments

Comments
 (0)