mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 13:00:56 +01:00
Render more info for binary files in Differential
Summary: Ref T10856. The rendering logic was already there, but it was expecting the information under `properties` field, whereas arc puts it under `metadata`. Not sure if that something that changed a long time ago or if it was always like this. Test Plan: {F1252657 size=full} Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T10856 Differential Revision: https://secure.phabricator.com/D15828
This commit is contained in:
parent
b3477bfc56
commit
e1119b3f31
2 changed files with 21 additions and 0 deletions
|
@ -626,6 +626,8 @@ abstract class DifferentialChangesetRenderer extends Phobject {
|
||||||
unset($old['unix:filemode']);
|
unset($old['unix:filemode']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$metadata = $changeset->getMetadata();
|
||||||
|
|
||||||
if ($this->hasOldFile()) {
|
if ($this->hasOldFile()) {
|
||||||
$file = $this->getOldFile();
|
$file = $this->getOldFile();
|
||||||
if ($file->getImageWidth()) {
|
if ($file->getImageWidth()) {
|
||||||
|
@ -634,6 +636,12 @@ abstract class DifferentialChangesetRenderer extends Phobject {
|
||||||
}
|
}
|
||||||
$old['file:mimetype'] = $file->getMimeType();
|
$old['file:mimetype'] = $file->getMimeType();
|
||||||
$old['file:size'] = phutil_format_bytes($file->getByteSize());
|
$old['file:size'] = phutil_format_bytes($file->getByteSize());
|
||||||
|
} else {
|
||||||
|
$old['file:mimetype'] = idx($metadata, 'old:file:mime-type');
|
||||||
|
$size = idx($metadata, 'old:file:size');
|
||||||
|
if ($size !== null) {
|
||||||
|
$old['file:size'] = phutil_format_bytes($size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->hasNewFile()) {
|
if ($this->hasNewFile()) {
|
||||||
|
@ -644,6 +652,12 @@ abstract class DifferentialChangesetRenderer extends Phobject {
|
||||||
}
|
}
|
||||||
$new['file:mimetype'] = $file->getMimeType();
|
$new['file:mimetype'] = $file->getMimeType();
|
||||||
$new['file:size'] = phutil_format_bytes($file->getByteSize());
|
$new['file:size'] = phutil_format_bytes($file->getByteSize());
|
||||||
|
} else {
|
||||||
|
$new['file:mimetype'] = idx($metadata, 'new:file:mime-type');
|
||||||
|
$size = idx($metadata, 'new:file:size');
|
||||||
|
if ($size !== null) {
|
||||||
|
$new['file:size'] = phutil_format_bytes($size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($old, $new);
|
return array($old, $new);
|
||||||
|
|
|
@ -32,6 +32,13 @@ abstract class DifferentialChangesetTestRenderer
|
||||||
$changeset = $this->getChangeset();
|
$changeset = $this->getChangeset();
|
||||||
list($old, $new) = $this->getChangesetProperties($changeset);
|
list($old, $new) = $this->getChangesetProperties($changeset);
|
||||||
|
|
||||||
|
foreach (array_keys($old) as $key) {
|
||||||
|
if ($old[$key] === idx($new, $key)) {
|
||||||
|
unset($old[$key]);
|
||||||
|
unset($new[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$old && !$new) {
|
if (!$old && !$new) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue