mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Prevent "Call webhooks" Herald action from appearing in UI for adapters which can't fire it
Summary: See <https://discourse.phabricator-community.org/t/herald-webhook-is-not-called-but-herald-transcript-tells-me-the-opposite/1098>. The "Commit Hook" events don't operate on objects and don't use TransactionEditors. They can't call webhooks in a normal way and currently don't call webhooks at all. Stop offering these actions in the UI. The "Outbound Mail" event also fires oddly and likely doesn't make much sense to hook anyway. Test Plan: Verified that these events no longer offer "Call webhooks", while normal events still do. Differential Revision: https://secure.phabricator.com/D19061
This commit is contained in:
parent
5e6e9fcc56
commit
4fa99374be
4 changed files with 17 additions and 0 deletions
|
@ -87,4 +87,8 @@ abstract class HeraldPreCommitAdapter extends HeraldAdapter {
|
|||
$this->hookEngine->getRepository()->getProjectPHIDs());
|
||||
}
|
||||
|
||||
public function supportsWebhooks() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,10 @@ final class HeraldCallWebhookAction extends HeraldAction {
|
|||
}
|
||||
|
||||
public function supportsObject($object) {
|
||||
if (!$this->getAdapter()->supportsWebhooks()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1211,6 +1211,11 @@ abstract class HeraldAdapter extends Phobject {
|
|||
/* -( Webhooks )----------------------------------------------------------- */
|
||||
|
||||
|
||||
public function supportsWebhooks() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
final public function queueWebhook($webhook_phid, $rule_phid) {
|
||||
$this->webhookMap[$webhook_phid][] = $rule_phid;
|
||||
return $this;
|
||||
|
|
|
@ -64,4 +64,8 @@ final class PhabricatorMailOutboundMailHeraldAdapter
|
|||
return pht('Mail %d', $this->getObject()->getID());
|
||||
}
|
||||
|
||||
public function supportsWebhooks() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue