Differential D18984 Diff 45535 src/applications/metamta/herald/PhabricatorMailMustEncryptHeraldAction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/herald/PhabricatorMailMustEncryptHeraldAction.php
- This file was added.
<?php | |||||
final class PhabricatorMailMustEncryptHeraldAction | |||||
extends HeraldAction { | |||||
const DO_MUST_ENCRYPT = 'do.must-encrypt'; | |||||
const ACTIONCONST = 'email.must-encrypt'; | |||||
public function getHeraldActionName() { | |||||
return pht('Require secure email'); | |||||
} | |||||
public function renderActionDescription($value) { | |||||
return pht( | |||||
'Require mail content be transmitted only over secure channels.'); | |||||
} | |||||
public function supportsObject($object) { | |||||
return self::isMailGeneratingObject($object); | |||||
} | |||||
amckinley: Leftover debugging code? | |||||
Not Done Inline ActionsYikes, thanks. Maybe I can write a lint rule to catch this. epriestley: Yikes, thanks. Maybe I can write a lint rule to catch this. | |||||
public function getActionGroupKey() { | |||||
return HeraldUtilityActionGroup::ACTIONGROUPKEY; | |||||
} | |||||
public function supportsRuleType($rule_type) { | |||||
return ($rule_type != HeraldRuleTypeConfig::RULE_TYPE_PERSONAL); | |||||
} | |||||
public function getHeraldActionStandardType() { | |||||
return self::STANDARD_NONE; | |||||
} | |||||
public function applyEffect($object, HeraldEffect $effect) { | |||||
$rule_phid = $effect->getRule()->getPHID(); | |||||
$adapter = $this->getAdapter(); | |||||
$adapter->addMustEncryptReason($rule_phid); | |||||
$this->logEffect(self::DO_MUST_ENCRYPT, array($rule_phid)); | |||||
} | |||||
protected function getActionEffectMap() { | |||||
return array( | |||||
self::DO_MUST_ENCRYPT => array( | |||||
'icon' => 'fa-shield', | |||||
'color' => 'blue', | |||||
'name' => pht('Must Encrypt'), | |||||
), | |||||
); | |||||
} | |||||
protected function renderActionEffectDescription($type, $data) { | |||||
switch ($type) { | |||||
case self::DO_MUST_ENCRYPT: | |||||
return pht( | |||||
'Made it a requirement that mail content be transmitted only '. | |||||
'over secure channels.'); | |||||
} | |||||
Not Done Inline Actions"can be transmitted"? amckinley: "can be transmitted"? | |||||
Not Done Inline ActionsI think there's technically a grammatical parsing of this, but upon re-reading it I agree it's pretty clumsy:
In the UI, this phrase appears in the past tense (when looking at a transcript, explaining what actions Herald took) while the other one appears in the present tense (when looking at a rule, explaining what will happen when it matches) which is why the phrasing is a little weird. epriestley: I think there's technically a grammatical parsing of this, but upon re-reading it I agree it's… | |||||
} | |||||
} |
Leftover debugging code?