@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.

Index "Call Webhook" in Herald, and show calling rules on the Webhook page

Summary:
Depends on D20259. Now that we can index Herald rules to affected objects, show callers on the "Webhooks" UI.

A few other rule types could get indexes too ("Sign Legalpad Documents", "Add Reviewers", "Add Subscribers"), but I think they're less likely to be useful since those triggers are usually more obvious (the transaction timeline makes it clearer what happened/why). We could revisit this in the future now that it's a possibility.

Test Plan: {F6260106}

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Differential Revision: https://secure.phabricator.com/D20260

+46
+1
src/applications/harbormaster/controller/HarbormasterPlanViewController.php
··· 496 496 ->withDisabled(false) 497 497 ->withAffectedObjectPHIDs(array($plan->getPHID())) 498 498 ->needValidateAuthors(true) 499 + ->setLimit(10) 499 500 ->execute(); 500 501 501 502 $list = id(new HeraldRuleListView())
+4
src/applications/herald/action/HeraldCallWebhookAction.php
··· 63 63 return new HeraldWebhookDatasource(); 64 64 } 65 65 66 + public function getPHIDsAffectedByAction(HeraldActionRecord $record) { 67 + return $record->getTarget(); 68 + } 69 + 66 70 }
+41
src/applications/herald/controller/HeraldWebhookViewController.php
··· 73 73 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 74 74 ->setTable($requests_table); 75 75 76 + $rules_view = $this->newRulesView($hook); 77 + 76 78 $hook_view = id(new PHUITwoColumnView()) 77 79 ->setHeader($header) 78 80 ->setMainColumn( 79 81 array( 80 82 $warnings, 81 83 $properties_view, 84 + $rules_view, 82 85 $requests_view, 83 86 $timeline, 84 87 )) ··· 192 195 ->setHeaderText(pht('Details')) 193 196 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 194 197 ->appendChild($properties); 198 + } 199 + 200 + private function newRulesView(HeraldWebhook $hook) { 201 + $viewer = $this->getViewer(); 202 + 203 + $rules = id(new HeraldRuleQuery()) 204 + ->setViewer($viewer) 205 + ->withDisabled(false) 206 + ->withAffectedObjectPHIDs(array($hook->getPHID())) 207 + ->needValidateAuthors(true) 208 + ->setLimit(10) 209 + ->execute(); 210 + 211 + $list = id(new HeraldRuleListView()) 212 + ->setViewer($viewer) 213 + ->setRules($rules) 214 + ->newObjectList(); 215 + 216 + $list->setNoDataString(pht('No active Herald rules call this webhook.')); 217 + 218 + $more_href = new PhutilURI( 219 + '/herald/', 220 + array('affectedPHID' => $hook->getPHID())); 221 + 222 + $more_link = id(new PHUIButtonView()) 223 + ->setTag('a') 224 + ->setIcon('fa-list-ul') 225 + ->setText(pht('View All Rules')) 226 + ->setHref($more_href); 227 + 228 + $header = id(new PHUIHeaderView()) 229 + ->setHeader(pht('Called By Herald Rules')) 230 + ->addActionLink($more_link); 231 + 232 + return id(new PHUIObjectBoxView()) 233 + ->setHeader($header) 234 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 235 + ->appendChild($list); 195 236 } 196 237 197 238 }