mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +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,6 +48,8 @@ class DifferentialChangesetViewController extends DifferentialController {
|
||||||
$view = $request->getStr('view');
|
$view = $request->getStr('view');
|
||||||
if ($view) {
|
if ($view) {
|
||||||
$changeset->attachHunks($changeset->loadHunks());
|
$changeset->attachHunks($changeset->loadHunks());
|
||||||
|
$type = $changeset->getFileType();
|
||||||
|
if ($type === DifferentialChangeType::FILE_TEXT) {
|
||||||
switch ($view) {
|
switch ($view) {
|
||||||
case 'new':
|
case 'new':
|
||||||
return $this->buildRawFileResponse($changeset->makeNewFile());
|
return $this->buildRawFileResponse($changeset->makeNewFile());
|
||||||
|
@ -56,6 +58,11 @@ class DifferentialChangesetViewController extends DifferentialController {
|
||||||
default:
|
default:
|
||||||
return new Aphront400Response();
|
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/");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($vs && ($vs != -1)) {
|
if ($vs && ($vs != -1)) {
|
||||||
|
|
|
@ -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