2011-05-01 04:40:05 +02:00
|
|
|
<?php
|
|
|
|
|
2012-03-13 19:18:11 +01:00
|
|
|
final class DifferentialExceptionMail extends DifferentialMail {
|
2011-05-01 04:40:05 +02:00
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
DifferentialRevision $revision,
|
|
|
|
Exception $exception,
|
|
|
|
$original_body) {
|
|
|
|
|
|
|
|
$this->revision = $revision;
|
|
|
|
$this->exception = $exception;
|
|
|
|
$this->originalBody = $original_body;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function renderBody() {
|
|
|
|
// Never called since buildBody() is overridden.
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function renderSubject() {
|
2012-06-11 21:21:37 +02:00
|
|
|
return "Exception: unable to process your mail request";
|
2011-05-01 04:40:05 +02:00
|
|
|
}
|
|
|
|
|
2012-06-11 21:21:37 +02:00
|
|
|
protected function renderVaryPrefix() {
|
|
|
|
return '';
|
Fix various threading issues, particularly in Gmail
Summary:
- Add an explicit multiplexing option, and enable it by default. This is necessary for Mail.app to coexist with other clients ("Re:" breaks outlook at the very least, and generally sucks in the common case), and allows users with flexible clients to enable subject variance.
- Add an option for subject line variance. Default to not varying the subject, so mail no longer says [Committed], [Closed], etc. This is so the defaults thread correctly in Gmail (not entirely sure this actually works).
- Add a preference to enable subject line variance.
- Unless all mail is multiplexed, don't enable or respect the "Re" or "vary subject" preferences. These are currently shown and respected in non-multiplex cases, which creates inconsistent results.
NOTE: @jungejason @nh @vrana This changes the default behavior (from non-multiplexing to multiplexing), and might break Facebook's integration. You should be able to keep the same behavior by setting the options appropriately, although if you can get the new defaults working they're probably better.
Test Plan:
Send mail from Maniphest, Differential and Audit. Updated preferences. Enabled/disabled multiplexing. Things seem OK?
NOTE: I haven't actually been able to repro the Gmail threading issue so I'm not totally sure what's going on there, maybe it started respecting "Re:" (or always has), but @cpiro and @20after4 both reported it independently. This fixes a bunch of bugs in any case and gives us more conservative set of defaults.
I'll see if I can buff out the Gmail story a bit but every client is basically a giant black box of mystery. :/
Reviewers: btrahan, vrana, jungejason, nh
Reviewed By: btrahan
CC: cpiro, 20after4, aran
Maniphest Tasks: T1097, T847
Differential Revision: https://secure.phabricator.com/D2206
2012-04-12 18:31:03 +02:00
|
|
|
}
|
|
|
|
|
2011-05-01 04:40:05 +02:00
|
|
|
protected function buildBody() {
|
|
|
|
$exception = $this->exception;
|
|
|
|
$original_body = $this->originalBody;
|
|
|
|
|
|
|
|
$message = $exception->getMessage();
|
|
|
|
|
|
|
|
return <<<EOBODY
|
|
|
|
Your request failed because an exception was encoutered while processing it:
|
|
|
|
|
|
|
|
EXCEPTION: {$message}
|
|
|
|
|
2012-07-12 22:33:26 +02:00
|
|
|
-- Original Body -------------------------------------------------------------
|
2011-05-01 04:40:05 +02:00
|
|
|
|
|
|
|
{$original_body}
|
|
|
|
|
|
|
|
EOBODY;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|