Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13995751
D7436.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Referenced Files
None
Subscribers
None
D7436.diff
View Options
Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -509,7 +509,7 @@
'DiffusionRepositoryEditBasicController' => 'applications/diffusion/controller/DiffusionRepositoryEditBasicController.php',
'DiffusionRepositoryEditBranchesController' => 'applications/diffusion/controller/DiffusionRepositoryEditBranchesController.php',
'DiffusionRepositoryEditController' => 'applications/diffusion/controller/DiffusionRepositoryEditController.php',
- 'DiffusionRepositoryEditDeleteController' => 'applications/diffusion/controller/DiffusionRepositoryEditDeleteControler.php',
+ 'DiffusionRepositoryEditDeleteController' => 'applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php',
'DiffusionRepositoryEditEncodingController' => 'applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php',
'DiffusionRepositoryEditLocalController' => 'applications/diffusion/controller/DiffusionRepositoryEditLocalController.php',
'DiffusionRepositoryEditMainController' => 'applications/diffusion/controller/DiffusionRepositoryEditMainController.php',
@@ -1631,6 +1631,7 @@
'PhabricatorRepositoryCreateController' => 'applications/repository/controller/PhabricatorRepositoryCreateController.php',
'PhabricatorRepositoryDAO' => 'applications/repository/storage/PhabricatorRepositoryDAO.php',
'PhabricatorRepositoryDiscoveryEngine' => 'applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php',
+ 'PhabricatorRepositoryEditController' => 'applications/repository/controller/PhabricatorRepositoryEditController.php',
'PhabricatorRepositoryEditor' => 'applications/repository/editor/PhabricatorRepositoryEditor.php',
'PhabricatorRepositoryEngine' => 'applications/repository/engine/PhabricatorRepositoryEngine.php',
'PhabricatorRepositoryGitCommitChangeParserWorker' => 'applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php',
@@ -3957,6 +3958,7 @@
'PhabricatorRepositoryCreateController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryDAO' => 'PhabricatorLiskDAO',
'PhabricatorRepositoryDiscoveryEngine' => 'PhabricatorRepositoryEngine',
+ 'PhabricatorRepositoryEditController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorRepositoryGitCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker',
'PhabricatorRepositoryGitCommitMessageParserWorker' => 'PhabricatorRepositoryCommitMessageParserWorker',
Index: src/applications/herald/adapter/HeraldAdapter.php
===================================================================
--- src/applications/herald/adapter/HeraldAdapter.php
+++ src/applications/herald/adapter/HeraldAdapter.php
@@ -44,15 +44,16 @@
const CONDITION_UNCONDITIONALLY = 'unconditionally';
const CONDITION_REGEXP_PAIR = 'regexp-pair';
- const ACTION_ADD_CC = 'addcc';
- const ACTION_REMOVE_CC = 'remcc';
- const ACTION_EMAIL = 'email';
- const ACTION_NOTHING = 'nothing';
- const ACTION_AUDIT = 'audit';
- const ACTION_FLAG = 'flag';
- const ACTION_ASSIGN_TASK = 'assigntask';
- const ACTION_ADD_PROJECTS = 'addprojects';
- const ACTION_ADD_REVIEWERS = 'addreviewers';
+ const ACTION_ADD_CC = 'addcc';
+ const ACTION_REMOVE_CC = 'remcc';
+ const ACTION_EMAIL = 'email';
+ const ACTION_EMAIL_PROJECT = 'email-project';
+ const ACTION_NOTHING = 'nothing';
+ const ACTION_AUDIT = 'audit';
+ const ACTION_FLAG = 'flag';
+ const ACTION_ASSIGN_TASK = 'assigntask';
+ const ACTION_ADD_PROJECTS = 'addprojects';
+ const ACTION_ADD_REVIEWERS = 'addreviewers';
const ACTION_ADD_BLOCKING_REVIEWERS = 'addblockingreviewers';
const VALUE_TEXT = 'text';
@@ -480,27 +481,28 @@
switch ($rule_type) {
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
return array(
- self::ACTION_NOTHING => pht('Do nothing'),
- self::ACTION_ADD_CC => pht('Add emails to CC'),
- self::ACTION_REMOVE_CC => pht('Remove emails from CC'),
- self::ACTION_EMAIL => pht('Send an email to'),
- self::ACTION_AUDIT => pht('Trigger an Audit by'),
- self::ACTION_FLAG => pht('Mark with flag'),
- self::ACTION_ASSIGN_TASK => pht('Assign task to'),
- self::ACTION_ADD_PROJECTS => pht('Add projects'),
+ self::ACTION_NOTHING => pht('Do nothing'),
+ self::ACTION_ADD_CC => pht('Add emails to CC'),
+ self::ACTION_REMOVE_CC => pht('Remove emails from CC'),
+ self::ACTION_EMAIL => pht('Send an email to'),
+ self::ACTION_EMAIL_PROJECT => pht('Email project members'),
+ self::ACTION_AUDIT => pht('Trigger an Audit by'),
+ self::ACTION_FLAG => pht('Mark with flag'),
+ self::ACTION_ASSIGN_TASK => pht('Assign task to'),
+ self::ACTION_ADD_PROJECTS => pht('Add projects'),
self::ACTION_ADD_REVIEWERS => pht('Add reviewers'),
self::ACTION_ADD_BLOCKING_REVIEWERS => pht('Add blocking reviewers'),
);
case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
return array(
- self::ACTION_NOTHING => pht('Do nothing'),
- self::ACTION_ADD_CC => pht('Add me to CC'),
- self::ACTION_REMOVE_CC => pht('Remove me from CC'),
- self::ACTION_EMAIL => pht('Send me an email'),
- self::ACTION_AUDIT => pht('Trigger an Audit by me'),
- self::ACTION_FLAG => pht('Mark with flag'),
- self::ACTION_ASSIGN_TASK => pht('Assign task to me'),
- self::ACTION_ADD_PROJECTS => pht('Add projects'),
+ self::ACTION_NOTHING => pht('Do nothing'),
+ self::ACTION_ADD_CC => pht('Add me to CC'),
+ self::ACTION_REMOVE_CC => pht('Remove me from CC'),
+ self::ACTION_EMAIL => pht('Send me an email'),
+ self::ACTION_AUDIT => pht('Trigger an Audit by me'),
+ self::ACTION_FLAG => pht('Mark with flag'),
+ self::ACTION_ASSIGN_TASK => pht('Assign task to me'),
+ self::ACTION_ADD_PROJECTS => pht('Add projects'),
self::ACTION_ADD_REVIEWERS => pht('Add me as a reviewer'),
self::ACTION_ADD_BLOCKING_REVIEWERS =>
pht('Add me as a blocking reviewer'),
@@ -647,6 +649,7 @@
return self::VALUE_NONE;
case self::ACTION_AUDIT:
case self::ACTION_ADD_PROJECTS:
+ case self::ACTION_EMAIL_PROJECT:
return self::VALUE_PROJECT;
case self::ACTION_FLAG:
return self::VALUE_FLAG_COLOR;
Index: src/applications/herald/adapter/HeraldCommitAdapter.php
===================================================================
--- src/applications/herald/adapter/HeraldCommitAdapter.php
+++ src/applications/herald/adapter/HeraldCommitAdapter.php
@@ -119,6 +119,7 @@
return array(
self::ACTION_ADD_CC,
self::ACTION_EMAIL,
+ self::ACTION_EMAIL_PROJECT,
self::ACTION_AUDIT,
self::ACTION_NOTHING,
);
@@ -389,6 +390,23 @@
true,
pht('Great success at doing nothing.'));
break;
+ case self::ACTION_EMAIL_PROJECT:
+ $project_phids = $effect->getTarget();
+ $projects = id(new PhabricatorProjectQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->needMembers(true)
+ ->withPHIDs($project_phids)
+ ->execute();
+ $member_phid_vector = mpull($projects, 'getMemberPHIDs');
+ $member_phids = array_mergev($member_phid_vector);
+ foreach ($member_phids as $phid) {
+ $this->emailPHIDs[$phid] = true;
+ }
+ $result[] = new HeraldApplyTranscript(
+ $effect,
+ true,
+ pht('Added address to email targets.'));
+ break;
case self::ACTION_EMAIL:
foreach ($effect->getTarget() as $phid) {
$this->emailPHIDs[$phid] = true;
Index: src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
===================================================================
--- src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
+++ src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
@@ -347,6 +347,7 @@
self::ACTION_ADD_CC,
self::ACTION_REMOVE_CC,
self::ACTION_EMAIL,
+ self::ACTION_EMAIL_PROJECT,
self::ACTION_ADD_REVIEWERS,
self::ACTION_ADD_BLOCKING_REVIEWERS,
self::ACTION_NOTHING,
@@ -381,10 +382,6 @@
pht('Added addresses to CC list.'));
}
- $forbidden_ccs = array_fill_keys(
- nonempty($this->forbiddenCCs, array()),
- true);
-
foreach ($effects as $effect) {
$action = $effect->getAction();
switch ($action) {
@@ -399,49 +396,26 @@
$effect,
$this->revision->getPHID());
break;
+ case self::ACTION_EMAIL_PROJECT:
+ $project_phids = $effect->getTarget();
+ $projects = id(new PhabricatorProjectQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->needMembers(true)
+ ->withPHIDs($project_phids)
+ ->execute();
+ $member_phid_vector = mpull($projects, 'getMemberPHIDs');
+ $member_phids = array_mergev($member_phid_vector);
+ $mail_results = $this->takeMailEffect($effect, $member_phids);
+ $result = array_merge($result, $mail_results);
+ break;
case self::ACTION_EMAIL:
case self::ACTION_ADD_CC:
- $op = ($action == self::ACTION_EMAIL) ? 'email' : 'CC';
- $base_target = $effect->getTarget();
- $forbidden = array();
- foreach ($base_target as $key => $fbid) {
- if (isset($forbidden_ccs[$fbid])) {
- $forbidden[] = $fbid;
- unset($base_target[$key]);
- } else {
- if ($action == self::ACTION_EMAIL) {
- $this->emailPHIDs[$fbid] = true;
- } else {
- $this->newCCs[$fbid] = true;
- }
- }
- }
-
- if ($forbidden) {
- $failed = clone $effect;
- $failed->setTarget($forbidden);
- if ($base_target) {
- $effect->setTarget($base_target);
- $result[] = new HeraldApplyTranscript(
- $effect,
- true,
- pht('Added these addresses to %s list. '.
- 'Others could not be added.', $op));
- }
- $result[] = new HeraldApplyTranscript(
- $failed,
- false,
- pht('%s forbidden, these addresses have unsubscribed.', $op));
- } else {
- $result[] = new HeraldApplyTranscript(
- $effect,
- true,
- pht('Added addresses to %s list.', $op));
- }
+ $mail_results = $this->takeMailEffect($effect, $effect->getTarget());
+ $result = array_merge($result, $mail_results);
break;
case self::ACTION_REMOVE_CC:
- foreach ($effect->getTarget() as $fbid) {
- $this->remCCs[$fbid] = true;
+ foreach ($effect->getTarget() as $phid) {
+ $this->remCCs[$phid] = true;
}
$result[] = new HeraldApplyTranscript(
$effect,
@@ -474,4 +448,51 @@
}
return $result;
}
+
+ private function takeMailEffect(HeraldEffect $effect, array $phids) {
+ $result = array();
+ $action = $effect->getAction();
+ $op = ($action == self::ACTION_ADD_CC) ? 'CC' : 'email';
+ $forbidden_ccs = array_fill_keys(
+ nonempty($this->forbiddenCCs, array()),
+ true);
+ $forbidden = array();
+
+ foreach ($phids as $key => $phid) {
+ if (isset($forbidden_ccs[$phid])) {
+ $forbidden[] = $phid;
+ unset($phids[$key]);
+ } else {
+ if ($action == self::ACTION_ADD_CC) {
+ $this->newCCs[$phid] = true;
+ } else {
+ $this->emailPHIDs[$phid] = true;
+ }
+ }
+ }
+
+ if ($forbidden) {
+ $failed = clone $effect;
+ $failed->setTarget($forbidden);
+ if ($phids) {
+ $effect->setTarget($phids);
+ $result[] = new HeraldApplyTranscript(
+ $effect,
+ true,
+ pht('Added these addresses to %s list. '.
+ 'Others could not be added.', $op));
+ }
+ $result[] = new HeraldApplyTranscript(
+ $failed,
+ false,
+ pht('%s forbidden, these addresses have unsubscribed.', $op));
+ } else {
+ $result[] = new HeraldApplyTranscript(
+ $effect,
+ true,
+ pht('Added addresses to %s list.', $op));
+ }
+
+ return $result;
+ }
}
Index: src/applications/metamta/storage/PhabricatorMetaMTAMail.php
===================================================================
--- src/applications/metamta/storage/PhabricatorMetaMTAMail.php
+++ src/applications/metamta/storage/PhabricatorMetaMTAMail.php
@@ -1,7 +1,9 @@
<?php
/**
- * See #394445 for an explanation of why this thing even exists.
+ * Mail sending infrastructure is fragile. This class provides a mechanism to
+ * improve that reliability, by using the ironclad PHP + mySQL to retry
+ * periodically.
*
* @task recipients Managing Recipients
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 24, 3:11 PM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717762
Default Alt Text
D7436.diff (13 KB)
Attached To
Mode
D7436: Herald - add ability to email members of a project
Attached
Detach File
Event Timeline
Log In to Comment