Add support for partially uploaded files
Summary: Ref T7149. This flags allocated but incomplete files and doesn't explode when trying to download them. Files are marked complete when the last chunk is uploaded. I added a key on `<authorPHID, isPartial>` so we can show you a list of partially uploaded files and prompt you to resume them at some point down the road. Test Plan: Massaged debugging settings and uploaded README.md very slowly in 32b chunks. Saw the file lose its "Partial" flag when the last chunk finished. Reviewers: btrahan Reviewed By: btrahan Subscribers: joshuaspence, epriestley Maniphest Tasks: T7149 Differential Revision: https://secure.phabricator.com/D12063
This commit is contained in:
@@ -52,11 +52,21 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
|
||||
$ttl = $file->getTTL();
|
||||
if ($ttl !== null) {
|
||||
$ttl_tag = id(new PHUITagView())
|
||||
->setType(PHUITagView::TYPE_OBJECT)
|
||||
->setType(PHUITagView::TYPE_STATE)
|
||||
->setBackgroundColor(PHUITagView::COLOR_YELLOW)
|
||||
->setName(pht('Temporary'));
|
||||
$header->addTag($ttl_tag);
|
||||
}
|
||||
|
||||
$partial = $file->getIsPartial();
|
||||
if ($partial) {
|
||||
$partial_tag = id(new PHUITagView())
|
||||
->setType(PHUITagView::TYPE_STATE)
|
||||
->setBackgroundColor(PHUITagView::COLOR_ORANGE)
|
||||
->setName(pht('Partial Upload'));
|
||||
$header->addTag($partial_tag);
|
||||
}
|
||||
|
||||
$actions = $this->buildActionView($file);
|
||||
$timeline = $this->buildTransactionView($file);
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
@@ -126,21 +136,27 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
|
||||
->setObjectURI($this->getRequest()->getRequestURI())
|
||||
->setObject($file);
|
||||
|
||||
$can_download = !$file->getIsPartial();
|
||||
|
||||
if ($file->isViewableInBrowser()) {
|
||||
$view->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('View File'))
|
||||
->setIcon('fa-file-o')
|
||||
->setHref($file->getViewURI()));
|
||||
->setHref($file->getViewURI())
|
||||
->setDisabled(!$can_download)
|
||||
->setWorkflow(!$can_download));
|
||||
} else {
|
||||
$view->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setUser($viewer)
|
||||
->setRenderAsForm(true)
|
||||
->setDownload(true)
|
||||
->setRenderAsForm($can_download)
|
||||
->setDownload($can_download)
|
||||
->setName(pht('Download File'))
|
||||
->setIcon('fa-download')
|
||||
->setHref($file->getViewURI()));
|
||||
->setHref($file->getViewURI())
|
||||
->setDisabled(!$can_download)
|
||||
->setWorkflow(!$can_download));
|
||||
}
|
||||
|
||||
$view->addAction(
|
||||
|
||||
Reference in New Issue
Block a user