Page MenuHomePhabricator

D16151.id38856.diff
No OneTemporary

D16151.id38856.diff

diff --git a/src/applications/celerity/CelerityStaticResourceResponse.php b/src/applications/celerity/CelerityStaticResourceResponse.php
--- a/src/applications/celerity/CelerityStaticResourceResponse.php
+++ b/src/applications/celerity/CelerityStaticResourceResponse.php
@@ -13,6 +13,7 @@
private $packaged;
private $metadata = array();
private $metadataBlock = 0;
+ private $metadataLocked;
private $behaviors = array();
private $hasRendered = array();
private $postprocessorKey;
@@ -24,6 +25,13 @@
}
public function addMetadata($metadata) {
+ if ($this->metadataLocked) {
+ throw new Exception(
+ pht(
+ 'Attempting to add more metadata after metadata has been '.
+ 'locked.'));
+ }
+
$id = count($this->metadata);
$this->metadata[$id] = $metadata;
return $this->metadataBlock.'_'.$id;
@@ -189,6 +197,8 @@
}
public function renderHTMLFooter() {
+ $this->metadataLocked = true;
+
$data = array();
if ($this->metadata) {
$json_metadata = AphrontResponse::encodeJSONForHTTPResponse(
diff --git a/src/view/layout/PhabricatorActionListView.php b/src/view/layout/PhabricatorActionListView.php
--- a/src/view/layout/PhabricatorActionListView.php
+++ b/src/view/layout/PhabricatorActionListView.php
@@ -53,5 +53,11 @@
$actions);
}
+ public function getDropdownMenuMetadata() {
+ return array(
+ 'items' => (string)hsprintf('%s', $this),
+ );
+ }
+
}
diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php
--- a/src/view/phui/PHUIButtonView.php
+++ b/src/view/phui/PHUIButtonView.php
@@ -105,10 +105,7 @@
Javelin::initBehavior('phui-dropdown-menu');
$this->addSigil('phui-dropdown-menu');
- $this->setMetadata(
- array(
- 'items' => $actions,
- ));
+ $this->setMetadata($actions->getDropdownMenuMetadata());
return $this;
}
diff --git a/src/view/phui/PHUIListItemView.php b/src/view/phui/PHUIListItemView.php
--- a/src/view/phui/PHUIListItemView.php
+++ b/src/view/phui/PHUIListItemView.php
@@ -43,10 +43,7 @@
Javelin::initBehavior('phui-dropdown-menu');
$this->addSigil('phui-dropdown-menu');
- $this->setMetadata(
- array(
- 'items' => $actions,
- ));
+ $this->setMetadata($actions->getDropdownMenuMetadata());
return $this;
}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 5:42 AM (20 h, 48 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6917630
Default Alt Text
D16151.id38856.diff (2 KB)

Event Timeline