Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diffusion/herald/DiffusionBlockHeraldAction.php
12242 views
1
<?php
2
3
final class DiffusionBlockHeraldAction
4
extends HeraldAction {
5
6
const ACTIONCONST = 'diffusion.block';
7
8
const DO_BLOCK = 'do.block';
9
10
public function getHeraldActionName() {
11
return pht('Block push with message');
12
}
13
14
public function getActionGroupKey() {
15
return HeraldApplicationActionGroup::ACTIONGROUPKEY;
16
}
17
18
public function supportsObject($object) {
19
return ($object instanceof PhabricatorRepositoryPushLog);
20
}
21
22
public function supportsRuleType($rule_type) {
23
return ($rule_type != HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
24
}
25
26
public function applyEffect($object, HeraldEffect $effect) {
27
// This rule intentionally has no direct effect: the caller handles it
28
// after executing Herald.
29
$this->logEffect(self::DO_BLOCK);
30
}
31
32
public function getHeraldActionStandardType() {
33
return self::STANDARD_TEXT;
34
}
35
36
public function renderActionDescription($value) {
37
return pht('Block push with message: %s', $value);
38
}
39
40
protected function getActionEffectMap() {
41
return array(
42
self::DO_BLOCK => array(
43
'icon' => 'fa-stop',
44
'color' => 'red',
45
'name' => pht('Blocked Push'),
46
),
47
);
48
}
49
50
protected function renderActionEffectDescription($type, $data) {
51
switch ($type) {
52
case self::DO_BLOCK:
53
return pht('Blocked push.');
54
}
55
}
56
}
57
58