1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Deprecate generateProperties

Summary:
deprecate generateProperties() from class
DifferentialRevisionDetailRenderer. Custom fields now provides a much
more powerful version of generateProperties().

Depends on D814.

Test Plan:
implemented facebook task field with custom field and
verified it worked.

Reviewers: epriestley, tuomaspelkonen

Reviewed By: epriestley

CC: aran, jungejason, epriestley

Differential Revision: 826
This commit is contained in:
Jason Ge 2011-08-18 00:17:50 -07:00
parent 2bb4cf149e
commit 4693ffa82b
3 changed files with 2 additions and 34 deletions

View file

@ -29,15 +29,4 @@ abstract class DifferentialRevisionDetailRenderer {
*/ */
abstract public function generateActionLinks(DifferentialRevision $revision, abstract public function generateActionLinks(DifferentialRevision $revision,
DifferentialDiff $diff); DifferentialDiff $diff);
/**
* This function must return an array of properties. These
* properties will be shown below other properties on differential
* revision page. Array keys are used for property names and array
* values are used for the actual property values. These property
* values will be displayed on the page as they are given, so they
* should be properly escaped.
*/
abstract public function generateProperties(DifferentialRevision $revision,
DifferentialDiff $diff);
} }

View file

@ -163,21 +163,14 @@ class DifferentialRevisionViewController extends DifferentialController {
'differential.revision-custom-detail-renderer'); 'differential.revision-custom-detail-renderer');
if ($custom_renderer_class) { if ($custom_renderer_class) {
// TODO: Either deprecate generateProperties() or build a better version // TODO: build a better version of the action links and deprecate the
// of the action links and deprecate the whole class. Custom fields // whole DifferentialRevisionDetailRenderer class.
// now provide a much more powerful version of generateProperties().
PhutilSymbolLoader::loadClass($custom_renderer_class); PhutilSymbolLoader::loadClass($custom_renderer_class);
$custom_renderer = $custom_renderer =
newv($custom_renderer_class, array()); newv($custom_renderer_class, array());
$properties = $custom_renderer->generateProperties($revision, $target);
$revision_detail->setProperties($properties);
$actions = array_merge( $actions = array_merge(
$actions, $actions,
$custom_renderer->generateActionLinks($revision, $target)); $custom_renderer->generateActionLinks($revision, $target));
} else {
$revision_detail->setProperties(array());
} }
$whitespace = $request->getStr( $whitespace = $request->getStr(

View file

@ -19,7 +19,6 @@
final class DifferentialRevisionDetailView extends AphrontView { final class DifferentialRevisionDetailView extends AphrontView {
private $revision; private $revision;
private $properties;
private $actions; private $actions;
private $user; private $user;
private $auxiliaryFields = array(); private $auxiliaryFields = array();
@ -29,11 +28,6 @@ final class DifferentialRevisionDetailView extends AphrontView {
return $this; return $this;
} }
public function setProperties(array $properties) {
$this->properties = $properties;
return $this;
}
public function setActions(array $actions) { public function setActions(array $actions) {
$this->actions = $actions; $this->actions = $actions;
return $this; return $this;
@ -57,14 +51,6 @@ final class DifferentialRevisionDetailView extends AphrontView {
$revision = $this->revision; $revision = $this->revision;
$rows = array(); $rows = array();
foreach ($this->properties as $key => $field) {
$rows[] =
'<tr>'.
'<th>'.phutil_escape_html($key).':</th>'.
'<td>'.$field.'</td>'.
'</tr>';
}
foreach ($this->auxiliaryFields as $field) { foreach ($this->auxiliaryFields as $field) {
$value = $field->renderValueForRevisionView(); $value = $field->renderValueForRevisionView();
if ($value !== null) { if ($value !== null) {