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

Render deleted files in Phragment as disabled

Summary: This updates Phragment so that fragments that are currently considered deleted have a disabled status and have an additional attribute 'Deleted'.  It also places this effect on versions (in the history controller) that actually involve deleting the file.

Test Plan: Viewed deleted fragments and versions.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4205

Differential Revision: https://secure.phabricator.com/D7737
This commit is contained in:
James Rhodes 2013-12-09 07:52:24 +11:00
parent 67b37a5c1d
commit dabc7ea28d
4 changed files with 22 additions and 3 deletions

View file

@ -66,6 +66,10 @@ final class PhragmentBrowseController extends PhragmentController {
$item->addAttribute(pht(
'Latest Version %s',
$fragment->getLatestVersion()->getSequence()));
if ($fragment->isDeleted()) {
$item->setDisabled(true);
$item->addAttribute(pht('Deleted'));
}
} else {
$item->addAttribute('Directory');
}

View file

@ -134,9 +134,15 @@ abstract class PhragmentController extends PhabricatorController {
->setActionList($actions);
if (!$fragment->isDirectory()) {
$properties->addProperty(
pht('Type'),
pht('File'));
if ($fragment->isDeleted()) {
$properties->addProperty(
pht('Type'),
pht('File (Deleted)'));
} else {
$properties->addProperty(
pht('Type'),
pht('File'));
}
$properties->addProperty(
pht('Latest Version'),
$this->renderHandlesForPHIDs(array($fragment->getLatestVersionPHID())));

View file

@ -52,6 +52,11 @@ final class PhragmentHistoryController extends PhragmentController {
$version->getDateCreated(),
$viewer));
if ($version->getFilePHID() === null) {
$item->setDisabled(true);
$item->addAttribute('Deletion');
}
$disabled = !isset($files[$version->getFilePHID()]);
$action = id(new PHUIListItemView())
->setIcon('download')

View file

@ -42,6 +42,10 @@ final class PhragmentFragment extends PhragmentDAO
return $this->latestVersionPHID === null;
}
public function isDeleted() {
return $this->getLatestVersion()->getFilePHID() === null;
}
public function getLatestVersion() {
if ($this->latestVersionPHID === null) {
return null;