@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+35 -16
+35 -16
src/applications/herald/controller/HeraldTranscriptController.php
··· 453 453 454 454 $object_xscript = $xscript->getObjectTranscript(); 455 455 456 - $data = array(); 456 + $rows = array(); 457 457 if ($object_xscript) { 458 458 $phid = $object_xscript->getPHID(); 459 459 $handles = $this->handles; 460 460 461 - $data += array( 462 - pht('Object Name') => $object_xscript->getName(), 463 - pht('Object Type') => $object_xscript->getType(), 464 - pht('Object PHID') => $phid, 465 - pht('Object Link') => $handles[$phid]->renderLink(), 461 + $rows[] = array( 462 + pht('Object Name'), 463 + $object_xscript->getName(), 464 + ); 465 + 466 + $rows[] = array( 467 + pht('Object Type'), 468 + $object_xscript->getType(), 469 + ); 470 + 471 + $rows[] = array( 472 + pht('Object PHID'), 473 + $phid, 474 + ); 475 + 476 + $rows[] = array( 477 + pht('Object Link'), 478 + $handles[$phid]->renderLink(), 466 479 ); 467 480 } 468 481 469 - $data += $xscript->getMetadataMap(); 482 + foreach ($xscript->getMetadataMap() as $key => $value) { 483 + $rows[] = array( 484 + $key, 485 + $value, 486 + ); 487 + } 470 488 471 489 if ($object_xscript) { 472 490 foreach ($object_xscript->getFields() as $field => $value) { 473 - $field = idx($field_names, $field, '['.$field.'?]'); 474 - $data['Field: '.$field] = $value; 475 - } 476 - } 491 + if (isset($field_names[$field])) { 492 + $field_name = pht('Field: %s', $field_names[$field]); 493 + } else { 494 + $field_name = pht('Unknown Field ("%s")', $field_name); 495 + } 477 496 478 - $rows = array(); 479 - foreach ($data as $name => $value) { 480 - if (!($value instanceof PhutilSafeHTML)) { 481 497 if (!is_scalar($value) && !is_null($value)) { 482 498 $value = implode("\n", $value); 483 499 } ··· 490 506 ), 491 507 $value); 492 508 } 509 + 510 + $rows[] = array( 511 + $field_name, 512 + $value, 513 + ); 493 514 } 494 - 495 - $rows[] = array($name, $value); 496 515 } 497 516 498 517 $property_list = new PHUIPropertyListView();