Page MenuHomePhabricator

D20260.id48352.diff
No OneTemporary

D20260.id48352.diff

diff --git a/src/applications/herald/action/HeraldCallWebhookAction.php b/src/applications/herald/action/HeraldCallWebhookAction.php
--- a/src/applications/herald/action/HeraldCallWebhookAction.php
+++ b/src/applications/herald/action/HeraldCallWebhookAction.php
@@ -63,4 +63,8 @@
return new HeraldWebhookDatasource();
}
+ public function getPHIDsAffectedByAction(HeraldActionRecord $record) {
+ return $record->getTarget();
+ }
+
}
diff --git a/src/applications/herald/controller/HeraldWebhookViewController.php b/src/applications/herald/controller/HeraldWebhookViewController.php
--- a/src/applications/herald/controller/HeraldWebhookViewController.php
+++ b/src/applications/herald/controller/HeraldWebhookViewController.php
@@ -73,12 +73,15 @@
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($requests_table);
+ $rules_view = $this->newRulesView($hook);
+
$hook_view = id(new PHUITwoColumnView())
->setHeader($header)
->setMainColumn(
array(
$warnings,
$properties_view,
+ $rules_view,
$requests_view,
$timeline,
))
@@ -194,4 +197,41 @@
->appendChild($properties);
}
+ private function newRulesView(HeraldWebhook $hook) {
+ $viewer = $this->getViewer();
+
+ $rules = id(new HeraldRuleQuery())
+ ->setViewer($viewer)
+ ->withDisabled(false)
+ ->withAffectedObjectPHIDs(array($hook->getPHID()))
+ ->needValidateAuthors(true)
+ ->execute();
+
+ $list = id(new HeraldRuleListView())
+ ->setViewer($viewer)
+ ->setRules($rules)
+ ->newObjectList();
+
+ $list->setNoDataString(pht('No active Herald rules call this webhook.'));
+
+ $more_href = new PhutilURI(
+ '/herald/',
+ array('affectedPHID' => $hook->getPHID()));
+
+ $more_link = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setIcon('fa-list-ul')
+ ->setText(pht('View All Rules'))
+ ->setHref($more_href);
+
+ $header = id(new PHUIHeaderView())
+ ->setHeader(pht('Called By Herald Rules'))
+ ->addActionLink($more_link);
+
+ return id(new PHUIObjectBoxView())
+ ->setHeader($header)
+ ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
+ ->appendChild($list);
+ }
+
}
diff --git a/src/applications/herald/query/HeraldRuleQuery.php b/src/applications/herald/query/HeraldRuleQuery.php
--- a/src/applications/herald/query/HeraldRuleQuery.php
+++ b/src/applications/herald/query/HeraldRuleQuery.php
@@ -267,7 +267,7 @@
$this->triggerObjectPHIDs);
}
- if ($this->affectedObjectPHIDs) {
+ if ($this->affectedObjectPHIDs !== null) {
$where[] = qsprintf(
$conn,
'edge_affects.dst IN (%Ls)',
diff --git a/src/applications/herald/query/HeraldRuleSearchEngine.php b/src/applications/herald/query/HeraldRuleSearchEngine.php
--- a/src/applications/herald/query/HeraldRuleSearchEngine.php
+++ b/src/applications/herald/query/HeraldRuleSearchEngine.php
@@ -85,7 +85,7 @@
$query->withActive($map['active']);
}
- if ($map['affectedPHIDs'] !== null) {
+ if ($map['affectedPHIDs']) {
$query->withAffectedObjectPHIDs($map['affectedPHIDs']);
}

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 22, 1:16 AM (4 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7229731
Default Alt Text
D20260.id48352.diff (3 KB)

Event Timeline