Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
<?php | <?php | ||||
/** | /** | ||||
* @task recipients Managing Recipients | * @task recipients Managing Recipients | ||||
*/ | */ | ||||
final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO { | final class PhabricatorMetaMTAMail | ||||
extends PhabricatorMetaMTADAO | |||||
implements PhabricatorPolicyInterface { | |||||
const STATUS_QUEUE = 'queued'; | const STATUS_QUEUE = 'queued'; | ||||
const STATUS_SENT = 'sent'; | const STATUS_SENT = 'sent'; | ||||
const STATUS_FAIL = 'fail'; | const STATUS_FAIL = 'fail'; | ||||
const STATUS_VOID = 'void'; | const STATUS_VOID = 'void'; | ||||
const RETRY_DELAY = 5; | const RETRY_DELAY = 5; | ||||
Show All 9 Lines | public function __construct() { | ||||
$this->status = self::STATUS_QUEUE; | $this->status = self::STATUS_QUEUE; | ||||
$this->parameters = array(); | $this->parameters = array(); | ||||
parent::__construct(); | parent::__construct(); | ||||
} | } | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | |||||
self::CONFIG_SERIALIZATION => array( | self::CONFIG_SERIALIZATION => array( | ||||
'parameters' => self::SERIALIZATION_JSON, | 'parameters' => self::SERIALIZATION_JSON, | ||||
), | ), | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'status' => 'text32', | 'status' => 'text32', | ||||
'relatedPHID' => 'phid?', | 'relatedPHID' => 'phid?', | ||||
// T6203/NULLABILITY | // T6203/NULLABILITY | ||||
Show All 9 Lines | return array( | ||||
), | ), | ||||
'key_created' => array( | 'key_created' => array( | ||||
'columns' => array('dateCreated'), | 'columns' => array('dateCreated'), | ||||
), | ), | ||||
), | ), | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
public function generatePHID() { | |||||
return PhabricatorPHID::generateNewPHID( | |||||
PhabricatorMetaMTAMailPHIDType::TYPECONST); | |||||
} | |||||
protected function setParam($param, $value) { | protected function setParam($param, $value) { | ||||
$this->parameters[$param] = $value; | $this->parameters[$param] = $value; | ||||
return $this; | return $this; | ||||
} | } | ||||
protected function getParam($param, $default = null) { | protected function getParam($param, $default = null) { | ||||
return idx($this->parameters, $param, $default); | return idx($this->parameters, $param, $default); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 923 Lines • ▼ Show 20 Lines | try { | ||||
1); | 1); | ||||
return false; | return false; | ||||
} catch (PhabricatorSystemActionRateLimitException $ex) { | } catch (PhabricatorSystemActionRateLimitException $ex) { | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */ | |||||
public function getCapabilities() { | |||||
return array( | |||||
PhabricatorPolicyCapability::CAN_VIEW, | |||||
); | |||||
} | |||||
public function getPolicy($capability) { | |||||
return PhabricatorPolicies::POLICY_NOONE; | |||||
} | |||||
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | |||||
$actor_phids = $this->getAllActorPHIDs(); | |||||
epriestley: You may need to call `expandRecipients()` on this, too -- I think `getAllActorPHIDs()` includes… | |||||
$actor_phids = $this->expandRecipients($actor_phids); | |||||
return in_array($viewer->getPHID(), $actor_phids); | |||||
} | |||||
public function describeAutomaticCapability($capability) { | |||||
return pht( | |||||
'The mail sender and message recipients can always see the mail.'); | |||||
} | |||||
} | } |
You may need to call expandRecipients() on this, too -- I think getAllActorPHIDs() includes recipients like projects in raw form, as PHID-PROJ-xyz. expandRecipients() will expand them into the underlying users, PHID-USER-xyz. This should be moot once edges show up.