1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Make "DifferentialDiff->properties" a proper "attachable" property

Summary:
See PHI498. This should be initialized to "self::ATTACHABLE" like other attachable properties, but is currently initialized to "array()".

Initialize it the normal way and try to catch all code paths which may have accessed it without actually loading and attaching it.

Also, remove UI for the very old "excuse" property, which "arc" has not written for well more than a year.

Test Plan: Grepped for affected symbols, loaded various revision pages. Somewhat tricky to be 100% sure that every pathway is caught, but it should be obvious if I missed anything once someone hits the code path.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Differential Revision: https://secure.phabricator.com/D21710
This commit is contained in:
epriestley 2021-07-26 11:37:35 -07:00
parent 387d3b4983
commit cc8cbed029
3 changed files with 5 additions and 29 deletions

View file

@ -1282,7 +1282,7 @@ final class DifferentialRevisionViewController
}
private function buildUnitMessagesView(
$diff,
DifferentialDiff $diff,
DifferentialRevision $revision) {
$viewer = $this->getViewer();
@ -1310,14 +1310,8 @@ final class DifferentialRevisionViewController
return null;
}
$excuse = null;
if ($diff->hasDiffProperty('arc:unit-excuse')) {
$excuse = $diff->getProperty('arc:unit-excuse');
}
return id(new HarbormasterUnitSummaryView())
->setViewer($viewer)
->setExcuse($excuse)
->setBuildable($diff->getBuildable())
->setUnitMessages($diff->getUnitMessages())
->setLimit(5)

View file

@ -42,7 +42,7 @@ final class DifferentialDiff
private $unsavedChangesets = array();
private $changesets = self::ATTACHABLE;
private $revision = self::ATTACHABLE;
private $properties = array();
private $properties = self::ATTACHABLE;
private $buildable = self::ATTACHABLE;
private $unitMessages = self::ATTACHABLE;
@ -338,6 +338,9 @@ final class DifferentialDiff
}
public function attachProperty($key, $value) {
if (!is_array($this->properties)) {
$this->properties = array();
}
$this->properties[$key] = $value;
return $this;
}

View file

@ -5,7 +5,6 @@ final class HarbormasterUnitSummaryView extends AphrontView {
private $buildable;
private $messages;
private $limit;
private $excuse;
private $showViewAll;
public function setBuildable(HarbormasterBuildable $buildable) {
@ -23,11 +22,6 @@ final class HarbormasterUnitSummaryView extends AphrontView {
return $this;
}
public function setExcuse($excuse) {
$this->excuse = $excuse;
return $this;
}
public function setShowViewAll($show_view_all) {
$this->showViewAll = $show_view_all;
return $this;
@ -88,21 +82,6 @@ final class HarbormasterUnitSummaryView extends AphrontView {
$table->setLimit($this->limit);
}
$excuse = $this->excuse;
if (strlen($excuse)) {
$excuse_icon = id(new PHUIIconView())
->setIcon('fa-commenting-o red');
$table->setNotice(
array(
$excuse_icon,
' ',
phutil_tag('strong', array(), pht('Excuse:')),
' ',
$excuse,
));
}
$box->setTable($table);
return $box;