Commit 19662e33 authored by epriestley's avatar epriestley
Browse files

In Herald transcript rendering, don't store display labels in keys

Summary:
Ref T13480. Currently, when Herald renders a transcript, it puts display labels into array keys. This is a bad pattern for several reasons, notably that the values must be scalar (so you can't add icons or other markup later) and the values must be unique (which is easily violated because many values are translated).

Instead, keep values as list items.

Test Plan: Viewed Herald transcripts, saw no (meaningful) change in rendering output.

Maniphest Tasks: T13480

Differential Revision: https://secure.phabricator.com/D20949
parent a5a9a5e0
......@@ -453,31 +453,47 @@ final class HeraldTranscriptController extends HeraldController {
$object_xscript = $xscript->getObjectTranscript();
$data = array();
$rows = array();
if ($object_xscript) {
$phid = $object_xscript->getPHID();
$handles = $this->handles;
$data += array(
pht('Object Name') => $object_xscript->getName(),
pht('Object Type') => $object_xscript->getType(),
pht('Object PHID') => $phid,
pht('Object Link') => $handles[$phid]->renderLink(),
$rows[] = array(
pht('Object Name'),
$object_xscript->getName(),
);
$rows[] = array(
pht('Object Type'),
$object_xscript->getType(),
);
$rows[] = array(
pht('Object PHID'),
$phid,
);
$rows[] = array(
pht('Object Link'),
$handles[$phid]->renderLink(),
);
}
$data += $xscript->getMetadataMap();
foreach ($xscript->getMetadataMap() as $key => $value) {
$rows[] = array(
$key,
$value,
);
}
if ($object_xscript) {
foreach ($object_xscript->getFields() as $field => $value) {
$field = idx($field_names, $field, '['.$field.'?]');
$data['Field: '.$field] = $value;
}
}
if (isset($field_names[$field])) {
$field_name = pht('Field: %s', $field_names[$field]);
} else {
$field_name = pht('Unknown Field ("%s")', $field_name);
}
$rows = array();
foreach ($data as $name => $value) {
if (!($value instanceof PhutilSafeHTML)) {
if (!is_scalar($value) && !is_null($value)) {
$value = implode("\n", $value);
}
......@@ -490,9 +506,12 @@ final class HeraldTranscriptController extends HeraldController {
),
$value);
}
}
$rows[] = array($name, $value);
$rows[] = array(
$field_name,
$value,
);
}
}
$property_list = new PHUIPropertyListView();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment