mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00: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');
|
$view = $request->getStr('view');
|
||||||
if ($view) {
|
if ($view) {
|
||||||
$changeset->attachHunks($changeset->loadHunks());
|
$changeset->attachHunks($changeset->loadHunks());
|
||||||
switch ($view) {
|
$type = $changeset->getFileType();
|
||||||
case 'new':
|
if ($type === DifferentialChangeType::FILE_TEXT) {
|
||||||
return $this->buildRawFileResponse($changeset->makeNewFile());
|
switch ($view) {
|
||||||
case 'old':
|
case 'new':
|
||||||
return $this->buildRawFileResponse($changeset->makeOldFile());
|
return $this->buildRawFileResponse($changeset->makeNewFile());
|
||||||
default:
|
case 'old':
|
||||||
return new Aphront400Response();
|
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/404');
|
||||||
phutil_require_module('phabricator', 'aphront/response/ajax');
|
phutil_require_module('phabricator', 'aphront/response/ajax');
|
||||||
phutil_require_module('phabricator', 'aphront/response/file');
|
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/controller/base');
|
||||||
phutil_require_module('phabricator', 'applications/differential/parser/changeset');
|
phutil_require_module('phabricator', 'applications/differential/parser/changeset');
|
||||||
phutil_require_module('phabricator', 'applications/differential/storage/changeset');
|
phutil_require_module('phabricator', 'applications/differential/storage/changeset');
|
||||||
|
|
Loading…
Reference in a new issue