@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<?php
2
3final class DiffusionAuditorsAddSelfHeraldAction
4 extends DiffusionAuditorsHeraldAction {
5
6 const ACTIONCONST = 'diffusion.auditors.self.add';
7
8 public function getHeraldActionName() {
9 return pht('Add me as an auditor');
10 }
11
12 // hide "Add me as an auditor" Herald action if Audit is disabled
13 public function supportsRuleType($rule_type) {
14 if (id(new PhabricatorAuditApplication())->isInstalled()) {
15 return ($rule_type == HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
16 } else {
17 return false;
18 }
19 }
20
21 public function applyEffect($object, HeraldEffect $effect) {
22 $rule = $effect->getRule();
23 $phid = $rule->getAuthorPHID();
24 return $this->applyAuditors(array($phid), $rule);
25 }
26
27 public function getHeraldActionStandardType() {
28 return self::STANDARD_NONE;
29 }
30
31 public function renderActionDescription($value) {
32 return pht('Add rule author as auditor.');
33 }
34
35}