Differential D13878 Diff 33512 src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | foreach ($messages as $message_key => $message) { | ||||
$info = array(); | $info = array(); | ||||
$info[] = pht('PROPERTIES'); | $info[] = pht('PROPERTIES'); | ||||
$info[] = pht('ID: %d', $message->getID()); | $info[] = pht('ID: %d', $message->getID()); | ||||
$info[] = pht('Status: %s', $message->getStatus()); | $info[] = pht('Status: %s', $message->getStatus()); | ||||
$info[] = pht('Related PHID: %s', $message->getRelatedPHID()); | $info[] = pht('Related PHID: %s', $message->getRelatedPHID()); | ||||
$info[] = pht('Message: %s', $message->getMessage()); | $info[] = pht('Message: %s', $message->getMessage()); | ||||
$ignore = array( | |||||
'body' => true, | |||||
'html-body' => true, | |||||
'headers' => true, | |||||
'attachments' => true, | |||||
'headers.sent' => true, | |||||
'authors.sent' => true, | |||||
); | |||||
$info[] = null; | $info[] = null; | ||||
$info[] = pht('PARAMETERS'); | $info[] = pht('PARAMETERS'); | ||||
$parameters = $message->getParameters(); | $parameters = $message->getParameters(); | ||||
foreach ($parameters as $key => $value) { | foreach ($parameters as $key => $value) { | ||||
if ($key == 'body') { | if (isset($ignore[$key])) { | ||||
continue; | |||||
} | |||||
if ($key == 'html-body') { | |||||
continue; | |||||
} | |||||
if ($key == 'headers') { | |||||
continue; | |||||
} | |||||
if ($key == 'attachments') { | |||||
continue; | continue; | ||||
} | } | ||||
if (!is_scalar($value)) { | if (!is_scalar($value)) { | ||||
$value = json_encode($value); | $value = json_encode($value); | ||||
} | } | ||||
$info[] = pht('%s: %s', $key, $value); | $info[] = pht('%s: %s', $key, $value); | ||||
} | } | ||||
$info[] = null; | $info[] = null; | ||||
$info[] = pht('HEADERS'); | $info[] = pht('HEADERS'); | ||||
foreach (idx($parameters, 'headers', array()) as $header) { | |||||
$headers = $message->getDeliveredHeaders(); | |||||
if (!$headers) { | |||||
$headers = $message->generateHeaders(); | |||||
} | |||||
foreach ($headers as $header) { | |||||
list($name, $value) = $header; | list($name, $value) = $header; | ||||
$info[] = "{$name}: {$value}"; | $info[] = "{$name}: {$value}"; | ||||
} | } | ||||
$attachments = idx($parameters, 'attachments'); | $attachments = idx($parameters, 'attachments'); | ||||
if ($attachments) { | if ($attachments) { | ||||
$info[] = null; | $info[] = null; | ||||
$info[] = pht('ATTACHMENTS'); | $info[] = pht('ATTACHMENTS'); | ||||
foreach ($attachments as $attachment) { | foreach ($attachments as $attachment) { | ||||
$info[] = idx($attachment, 'filename', pht('Unnamed File')); | $info[] = idx($attachment, 'filename', pht('Unnamed File')); | ||||
} | } | ||||
} | } | ||||
$actors = $message->loadAllActors(); | $all_actors = $message->loadAllActors(); | ||||
$actors = array_select_keys( | |||||
$actors, | $actors = $message->getDeliveredActors(); | ||||
array_merge($message->getToPHIDs(), $message->getCcPHIDs())); | if ($actors) { | ||||
$info[] = null; | $info[] = null; | ||||
$info[] = pht('RECIPIENTS'); | $info[] = pht('RECIPIENTS'); | ||||
foreach ($actors as $actor) { | foreach ($actors as $actor_phid => $actor_info) { | ||||
if ($actor->isDeliverable()) { | $actor = idx($all_actors, $actor_phid); | ||||
$info[] = ' '.coalesce($actor->getName(), $actor->getPHID()); | if ($actor) { | ||||
$actor_name = coalesce($actor->getName(), $actor_phid); | |||||
} else { | } else { | ||||
$info[] = '! '.coalesce($actor->getName(), $actor->getPHID()); | $actor_name = $actor_phid; | ||||
} | } | ||||
foreach ($actor->getDeliverabilityReasons() as $reason) { | |||||
$deliverable = $actor_info['deliverable']; | |||||
if ($deliverable) { | |||||
$info[] = ' '.$actor_name; | |||||
} else { | |||||
$info[] = '! '.$actor_name; | |||||
} | |||||
$reasons = $actor_info['reasons']; | |||||
foreach ($reasons as $reason) { | |||||
$name = PhabricatorMetaMTAActor::getReasonName($reason); | |||||
$desc = PhabricatorMetaMTAActor::getReasonDescription($reason); | $desc = PhabricatorMetaMTAActor::getReasonDescription($reason); | ||||
$info[] = ' - '.$desc; | $info[] = ' - '.$name.': '.$desc; | ||||
} | |||||
} | } | ||||
} | } | ||||
$info[] = null; | $info[] = null; | ||||
$info[] = pht('TEXT BODY'); | $info[] = pht('TEXT BODY'); | ||||
if (strlen($message->getBody())) { | if (strlen($message->getBody())) { | ||||
$info[] = $message->getBody(); | $info[] = $message->getBody(); | ||||
} else { | } else { | ||||
Show All 21 Lines |