Page MenuHomePhabricator

D10244.id24647.diff
No OneTemporary

D10244.id24647.diff

diff --git a/src/applications/metamta/management/PhabricatorMailManagementShowInboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementShowInboundWorkflow.php
--- a/src/applications/metamta/management/PhabricatorMailManagementShowInboundWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementShowInboundWorkflow.php
@@ -45,57 +45,8 @@
$last_key = last_key($messages);
foreach ($messages as $message_key => $message) {
- $info = array();
-
- $info[] = pht('PROPERTIES');
- $info[] = pht('ID: %d', $message->getID());
- $info[] = pht('Status: %s', $message->getStatus());
- $info[] = pht('Related PHID: %s', $message->getRelatedPHID());
- $info[] = pht('Author PHID: %s', $message->getAuthorPHID());
- $info[] = pht('Message ID Hash: %s', $message->getMessageIDHash());
-
- if ($message->getMessage()) {
- $info[] = null;
- $info[] = pht('MESSAGE');
- $info[] = $message->getMessage();
- }
-
- $info[] = null;
- $info[] = pht('HEADERS');
- foreach ($message->getHeaders() as $key => $value) {
- if (is_array($value)) {
- $value = implode("\n", $value);
- }
- $info[] = pht('%s: %s', $key, $value);
- }
-
- $bodies = $message->getBodies();
-
- $last_body = last_key($bodies);
-
- $info[] = null;
- $info[] = pht('BODIES');
- foreach ($bodies as $key => $value) {
- $info[] = pht('Body "%s"', $key);
- $info[] = $value;
- if ($key != $last_body) {
- $info[] = null;
- }
- }
-
- $attachments = $message->getAttachments();
-
- $info[] = null;
- $info[] = pht('ATTACHMENTS');
- if (!$attachments) {
- $info[] = pht('No attachments.');
- } else {
- foreach ($attachments as $attachment) {
- $info[] = pht('File PHID: %s', $attachment);
- }
- }
-
- $console->writeOut("%s\n", implode("\n", $info));
+ $info = $message->getMessageInfo();
+ $console->writeOut("%s\n", $info);
if ($message_key != $last_key) {
$console->writeOut("\n%s\n\n", str_repeat('-', 80));
diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
--- a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
+++ b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
@@ -151,6 +151,60 @@
return idx($this->bodies, 'text');
}
+ public function getMessageInfo() {
+ $info = array();
+
+ $info[] = pht('PROPERTIES');
+ $info[] = pht('ID: %d', $this->getID());
+ $info[] = pht('Status: %s', $this->getStatus());
+ $info[] = pht('Related PHID: %s', $this->getRelatedPHID());
+ $info[] = pht('Author PHID: %s', $this->getAuthorPHID());
+ $info[] = pht('Message ID Hash: %s', $this->getMessageIDHash());
+
+ if ($this->getMessage()) {
+ $info[] = null;
+ $info[] = pht('MESSAGE');
+ $info[] = $this->getMessage();
+ }
+
+ $info[] = null;
+ $info[] = pht('HEADERS');
+ foreach ($this->getHeaders() as $key => $value) {
+ if (is_array($value)) {
+ $value = implode("\n", $value);
+ }
+ $info[] = pht('%s: %s', $key, $value);
+ }
+
+ $bodies = $this->getBodies();
+
+ $last_body = last_key($bodies);
+
+ $info[] = null;
+ $info[] = pht('BODIES');
+ foreach ($bodies as $key => $value) {
+ $info[] = pht('Body "%s"', $key);
+ $info[] = $value;
+ if ($key != $last_body) {
+ $info[] = null;
+ }
+ }
+
+ $attachments = $this->getAttachments();
+
+ $info[] = null;
+ $info[] = pht('ATTACHMENTS');
+ if (!$attachments) {
+ $info[] = pht('No attachments.');
+ } else {
+ foreach ($attachments as $attachment) {
+ $info[] = pht('File PHID: %s', $attachment);
+ }
+ }
+ return implode("\n", $info);
+ }
+
+
/**
* Strip an email address down to the actual user@domain.tld part if
* necessary, since sometimes it will have formatting like
diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
--- a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
+++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
@@ -38,10 +38,28 @@
->withPHIDs(array($obj_phid))
->executeOne();
+ $title = pht('Raw Comment');
+ $body = $xaction->getComment()->getContent();
+ if ($request->getExists('email')) {
+ $content_source = $xaction->getContentSource();
+ $source_email = PhabricatorContentSource::SOURCE_EMAIL;
+ if ($content_source->getSource() == $source_email) {
+ $source_id = $content_source->getParam('id');
+ if ($source_id) {
+ $message = id(new PhabricatorMetaMTAReceivedMail())->loadOneWhere(
+ 'id = %d',
+ $source_id);
+ if ($message) {
+ $title = pht('Email Source');
+ $body = $message->getMessageInfo();
+ }
+ }
+ }
+ }
$dialog = id(new AphrontDialogView())
->setUser($user)
->addCancelButton($obj_handle->getURI())
- ->setTitle(pht('Raw Comment'));
+ ->setTitle($title);
$dialog
->addHiddenInput('anchor', $request->getStr('anchor'))
@@ -51,7 +69,7 @@
->appendChild(
id(new AphrontFormTextAreaControl())
->setReadOnly(true)
- ->setValue($xaction->getComment()->getContent())));
+ ->setValue($body)));
return id(new AphrontDialogResponse())->setDialog($dialog);
}
diff --git a/src/view/phui/PHUITimelineEventView.php b/src/view/phui/PHUITimelineEventView.php
--- a/src/view/phui/PHUITimelineEventView.php
+++ b/src/view/phui/PHUITimelineEventView.php
@@ -539,6 +539,28 @@
array(
'anchor' => $anchor,
));
+
+ $content_source = $this->getContentSource();
+ $source_email = PhabricatorContentSource::SOURCE_EMAIL;
+ if ($content_source->getSource() == $source_email) {
+ $source_id = $content_source->getParam('id');
+ if ($source_id) {
+ $message = id(new PhabricatorMetaMTAReceivedMail())->loadOneWhere(
+ 'id = %d',
+ $source_id);
+ if ($message) {
+ $items[] = id(new PhabricatorActionView())
+ ->setIcon('fa-envelope-o')
+ ->setHref('/transactions/raw/'.$xaction_phid.'/?email')
+ ->setName(pht('View Email'))
+ ->addSigil('transaction-raw')
+ ->setMetadata(
+ array(
+ 'anchor' => $anchor,
+ ));
+ }
+ }
+ }
}
if ($this->getIsRemovable()) {

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 16, 1:09 PM (2 w, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7705243
Default Alt Text
D10244.id24647.diff (6 KB)

Event Timeline