Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/query/PhabricatorMetaMTAActor.php
Show All 12 Lines | final class PhabricatorMetaMTAActor extends Phobject { | ||||
const REASON_MAIL_DISABLED = 'maildisabled'; | const REASON_MAIL_DISABLED = 'maildisabled'; | ||||
const REASON_EXTERNAL_TYPE = 'exernaltype'; | const REASON_EXTERNAL_TYPE = 'exernaltype'; | ||||
const REASON_RESPONSE = 'response'; | const REASON_RESPONSE = 'response'; | ||||
const REASON_SELF = 'self'; | const REASON_SELF = 'self'; | ||||
const REASON_MAILTAGS = 'mailtags'; | const REASON_MAILTAGS = 'mailtags'; | ||||
const REASON_BOT = 'bot'; | const REASON_BOT = 'bot'; | ||||
const REASON_FORCE = 'force'; | const REASON_FORCE = 'force'; | ||||
const REASON_FORCE_HERALD = 'force-herald'; | const REASON_FORCE_HERALD = 'force-herald'; | ||||
const REASON_ROUTE_AS_NOTIFICATION = 'route-as-notification'; | |||||
const REASON_ROUTE_AS_MAIL = 'route-as-mail'; | |||||
private $phid; | private $phid; | ||||
private $emailAddress; | private $emailAddress; | ||||
private $name; | private $name; | ||||
private $status = self::STATUS_DELIVERABLE; | private $status = self::STATUS_DELIVERABLE; | ||||
private $reasons = array(); | private $reasons = array(); | ||||
public function setName($name) { | public function setName($name) { | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | public function getDeliverabilityReasons() { | ||||
return $this->reasons; | return $this->reasons; | ||||
} | } | ||||
public static function isDeliveryReason($reason) { | public static function isDeliveryReason($reason) { | ||||
switch ($reason) { | switch ($reason) { | ||||
case self::REASON_NONE: | case self::REASON_NONE: | ||||
case self::REASON_FORCE: | case self::REASON_FORCE: | ||||
case self::REASON_FORCE_HERALD: | case self::REASON_FORCE_HERALD: | ||||
case self::REASON_ROUTE_AS_MAIL: | |||||
return true; | return true; | ||||
default: | default: | ||||
// All other reasons cause the message to not be delivered. | // All other reasons cause the message to not be delivered. | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
public static function getReasonName($reason) { | public static function getReasonName($reason) { | ||||
$names = array( | $names = array( | ||||
self::REASON_NONE => pht('None'), | self::REASON_NONE => pht('None'), | ||||
self::REASON_DISABLED => pht('Disabled Recipient'), | self::REASON_DISABLED => pht('Disabled Recipient'), | ||||
self::REASON_BOT => pht('Bot Recipient'), | self::REASON_BOT => pht('Bot Recipient'), | ||||
self::REASON_NO_ADDRESS => pht('No Address'), | self::REASON_NO_ADDRESS => pht('No Address'), | ||||
self::REASON_EXTERNAL_TYPE => pht('External Recipient'), | self::REASON_EXTERNAL_TYPE => pht('External Recipient'), | ||||
self::REASON_UNMAILABLE => pht('Not Mailable'), | self::REASON_UNMAILABLE => pht('Not Mailable'), | ||||
self::REASON_RESPONSE => pht('Similar Reply'), | self::REASON_RESPONSE => pht('Similar Reply'), | ||||
self::REASON_SELF => pht('Self Mail'), | self::REASON_SELF => pht('Self Mail'), | ||||
self::REASON_MAIL_DISABLED => pht('Mail Disabled'), | self::REASON_MAIL_DISABLED => pht('Mail Disabled'), | ||||
self::REASON_MAILTAGS => pht('Mail Tags'), | self::REASON_MAILTAGS => pht('Mail Tags'), | ||||
self::REASON_UNLOADABLE => pht('Bad Recipient'), | self::REASON_UNLOADABLE => pht('Bad Recipient'), | ||||
self::REASON_FORCE => pht('Forced Mail'), | self::REASON_FORCE => pht('Forced Mail'), | ||||
self::REASON_FORCE_HERALD => pht('Forced by Herald'), | self::REASON_FORCE_HERALD => pht('Forced by Herald'), | ||||
self::REASON_ROUTE_AS_NOTIFICATION => pht('Route as Notification'), | |||||
self::REASON_ROUTE_AS_MAIL => pht('Route as Mail'), | |||||
); | ); | ||||
return idx($names, $reason, pht('Unknown ("%s")', $reason)); | return idx($names, $reason, pht('Unknown ("%s")', $reason)); | ||||
} | } | ||||
public static function getReasonDescription($reason) { | public static function getReasonDescription($reason) { | ||||
$descriptions = array( | $descriptions = array( | ||||
self::REASON_NONE => pht( | self::REASON_NONE => pht( | ||||
Show All 32 Lines | $descriptions = array( | ||||
self::REASON_FORCE => pht( | self::REASON_FORCE => pht( | ||||
'Delivery of this mail is forced and ignores deliver preferences. '. | 'Delivery of this mail is forced and ignores deliver preferences. '. | ||||
'Mail which uses forced delivery is usually related to account '. | 'Mail which uses forced delivery is usually related to account '. | ||||
'management or authentication. For example, password reset email '. | 'management or authentication. For example, password reset email '. | ||||
'ignores mail preferences.'), | 'ignores mail preferences.'), | ||||
self::REASON_FORCE_HERALD => pht( | self::REASON_FORCE_HERALD => pht( | ||||
'This recipient was added by a "Send me an Email" rule in Herald, '. | 'This recipient was added by a "Send me an Email" rule in Herald, '. | ||||
'which overrides some delivery settings.'), | 'which overrides some delivery settings.'), | ||||
self::REASON_ROUTE_AS_NOTIFICATION => pht( | |||||
'This message was downgraded to a notification by outbound mail '. | |||||
'rules in Herald.'), | |||||
self::REASON_ROUTE_AS_MAIL => pht( | |||||
'This message was upgraded to email by outbound mail rules '. | |||||
'in Herald.'), | |||||
); | ); | ||||
return idx($descriptions, $reason, pht('Unknown Reason ("%s")', $reason)); | return idx($descriptions, $reason, pht('Unknown Reason ("%s")', $reason)); | ||||
} | } | ||||
} | } |