mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Provide better UX when trying to view binary file from differential
Summary: When a user selects "show raw file (right)" from the dropdown of a binary file in differential, they should get more than a blank page. Test Plan: Loaded a raw binary file from differential Reviewers: tuomaspelkonen, epriestley, jungejason Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1533
This commit is contained in:
parent
8b4c057c75
commit
28c9607fd0
2 changed files with 16 additions and 7 deletions
|
@ -48,13 +48,20 @@ class DifferentialChangesetViewController extends DifferentialController {
|
|||
$view = $request->getStr('view');
|
||||
if ($view) {
|
||||
$changeset->attachHunks($changeset->loadHunks());
|
||||
switch ($view) {
|
||||
case 'new':
|
||||
return $this->buildRawFileResponse($changeset->makeNewFile());
|
||||
case 'old':
|
||||
return $this->buildRawFileResponse($changeset->makeOldFile());
|
||||
default:
|
||||
return new Aphront400Response();
|
||||
$type = $changeset->getFileType();
|
||||
if ($type === DifferentialChangeType::FILE_TEXT) {
|
||||
switch ($view) {
|
||||
case 'new':
|
||||
return $this->buildRawFileResponse($changeset->makeNewFile());
|
||||
case 'old':
|
||||
return $this->buildRawFileResponse($changeset->makeOldFile());
|
||||
default:
|
||||
return new Aphront400Response();
|
||||
}
|
||||
} else if ($type === DifferentialChangeType::FILE_IMAGE ||
|
||||
$type === DifferentialChangeType::FILE_BINARY) {
|
||||
$phid = idx($changeset->getMetadata(), "$view:binary-phid");
|
||||
return id(new AphrontRedirectResponse())->setURI("/file/info/$phid/");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ phutil_require_module('phabricator', 'aphront/response/400');
|
|||
phutil_require_module('phabricator', 'aphront/response/404');
|
||||
phutil_require_module('phabricator', 'aphront/response/ajax');
|
||||
phutil_require_module('phabricator', 'aphront/response/file');
|
||||
phutil_require_module('phabricator', 'aphront/response/redirect');
|
||||
phutil_require_module('phabricator', 'applications/differential/constants/changetype');
|
||||
phutil_require_module('phabricator', 'applications/differential/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/differential/parser/changeset');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/changeset');
|
||||
|
|
Loading…
Reference in a new issue