1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Send audit emails to more users

Summary:
Audit has some weird rules about who gets email. Make them less weird:

  - When a user does "Add Auditors", email the auditors.
  - When a commit is commented on, email anyone in "concern" or "audit required" states.

@staticshock, my claim that I can't reproduce was crazy, I just have weird test data and read it wrong.

Test Plan: Added a user to an audit and verified they got an email.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: staticshock, aran

Differential Revision: https://secure.phabricator.com/D6414
This commit is contained in:
epriestley 2013-07-10 11:18:28 -07:00
parent c977168797
commit d467c49a66

View file

@ -407,7 +407,7 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
$threading = self::getMailThreading($repository, $commit);
list($thread_id, $thread_topic) = $threading;
$body = $this->renderMailBody(
$body = $this->renderMailBody(
$comment,
"{$name}: {$summary}",
$handle,
@ -419,7 +419,7 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
$author_phid = $data->getCommitDetail('authorPHID');
if ($author_phid) {
$email_to[] = $author_phid;
$email_to[$author_phid] = true;
}
foreach ($other_comments as $other_comment) {
@ -427,13 +427,22 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
}
foreach ($requests as $request) {
if ($request->getAuditStatus() == PhabricatorAuditStatusConstants::CC) {
$email_cc[$request->getAuditorPHID()] = true;
} else if ($request->getAuditStatus() ==
PhabricatorAuditStatusConstants::RESIGNED) {
unset($email_cc[$request->getAuditorPHID()]);
switch ($request->getAuditStatus()) {
case PhabricatorAuditStatusConstants::CC:
case PhabricatorAuditStatusConstants::AUDIT_REQUIRED:
$email_cc[$request->getAuditorPHID()] = true;
break;
case PhabricatorAuditStatusConstants::RESIGNED:
unset($email_cc[$request->getAuditorPHID()]);
break;
case PhabricatorAuditStatusConstants::CONCERNED:
case PhabricatorAuditStatusConstants::AUDIT_REQUESTED:
$email_to[$request->getAuditorPHID()] = true;
break;
}
}
$email_to = array_keys($email_to);
$email_cc = array_keys($email_cc);
$phids = array_merge($email_to, $email_cc);