Differential D11680 Diff 28251 src/applications/differential/mail/DifferentialCreateMailReceiver.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/mail/DifferentialCreateMailReceiver.php
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | protected function processReceivedMail( | ||||
$subject_prefix = | $subject_prefix = | ||||
PhabricatorEnv::getEnvConfig('metamta.differential.subject-prefix'); | PhabricatorEnv::getEnvConfig('metamta.differential.subject-prefix'); | ||||
if (count($diffs)) { | if (count($diffs)) { | ||||
$subject = pht( | $subject = pht( | ||||
'You successfully created %d diff(s).', | 'You successfully created %d diff(s).', | ||||
count($diffs)); | count($diffs)); | ||||
} else { | } else { | ||||
$subject = pht( | $subject = pht( | ||||
'Diff creation failed; see body for error(s).', | 'Diff creation failed; see body for %s error(s).', | ||||
joshuaspence: As above. | |||||
count($errors)); | new PhutilNumber(count($errors))); | ||||
} | } | ||||
$body = new PhabricatorMetaMTAMailBody(); | $body = new PhabricatorMetaMTAMailBody(); | ||||
$body->addRawSection($subject); | $body->addRawSection($subject); | ||||
if (count($diffs)) { | if (count($diffs)) { | ||||
$text_body = ''; | $text_body = ''; | ||||
$html_body = array(); | $html_body = array(); | ||||
$body_label = pht('DIFF LINK(S)', count($diffs)); | $body_label = pht('%s DIFF LINK(S)', new PhutilNumber(count($diffs))); | ||||
Not Done Inline ActionsAs above. joshuaspence: As above. | |||||
foreach ($diffs as $filename => $diff_uri) { | foreach ($diffs as $filename => $diff_uri) { | ||||
$text_body .= $filename.': '.$diff_uri."\n"; | $text_body .= $filename.': '.$diff_uri."\n"; | ||||
$html_body[] = phutil_tag( | $html_body[] = phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => $diff_uri, | 'href' => $diff_uri, | ||||
), | ), | ||||
$filename); | $filename); | ||||
$html_body[] = phutil_tag('br'); | $html_body[] = phutil_tag('br'); | ||||
} | } | ||||
$body->addTextSection($body_label, $text_body); | $body->addTextSection($body_label, $text_body); | ||||
$body->addHTMLSection($body_label, $html_body); | $body->addHTMLSection($body_label, $html_body); | ||||
} | } | ||||
if (count($errors)) { | if (count($errors)) { | ||||
$body_section = new PhabricatorMetaMTAMailSection(); | $body_section = new PhabricatorMetaMTAMailSection(); | ||||
$body_label = pht('ERROR(S)', count($errors)); | $body_label = pht('%s ERROR(S)', new PhutilNumber(count($errors))); | ||||
Not Done Inline ActionsAs above. joshuaspence: As above. | |||||
foreach ($errors as $error) { | foreach ($errors as $error) { | ||||
$body_section->addFragment($error); | $body_section->addFragment($error); | ||||
} | } | ||||
$body->addTextSection($body_label, $body_section); | $body->addTextSection($body_label, $body_section); | ||||
} | } | ||||
id(new PhabricatorMetaMTAMail()) | id(new PhabricatorMetaMTAMail()) | ||||
->addTos(array($sender->getPHID())) | ->addTos(array($sender->getPHID())) | ||||
->setSubject($subject) | ->setSubject($subject) | ||||
->setSubjectPrefix($subject_prefix) | ->setSubjectPrefix($subject_prefix) | ||||
->setFrom($sender->getPHID()) | ->setFrom($sender->getPHID()) | ||||
->setBody($body->render()) | ->setBody($body->render()) | ||||
->saveAndSend(); | ->saveAndSend(); | ||||
} | } | ||||
} | } |
As above.