mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
Add "View Email" action to application transactions
Summary: Should help with debugging. In the web UI there is now a link to "View Email". This uses the same debugging output that `./bin/mail show-outbound` uses. Fixes T5768. Code is very defensive as I think these tables may be truncated eventually? Test Plan: viewed some emails and it worked! Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5768 Differential Revision: https://secure.phabricator.com/D10244
This commit is contained in:
parent
0b7bae29c8
commit
ea3aeb4962
2 changed files with 48 additions and 2 deletions
|
@ -38,10 +38,36 @@ final class PhabricatorApplicationTransactionCommentRawController
|
|||
->withPHIDs(array($obj_phid))
|
||||
->executeOne();
|
||||
|
||||
$title = pht('Raw Comment');
|
||||
$body = $xaction->getComment()->getContent();
|
||||
$addendum = null;
|
||||
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 Body Text');
|
||||
$body = $message->getRawTextBody();
|
||||
$details_text = pht(
|
||||
'For full details, run `/bin/mail show-outbound --id %d`',
|
||||
$source_id);
|
||||
$addendum = PhabricatorMarkupEngine::renderOneObject(
|
||||
id(new PhabricatorMarkupOneOff())->setContent($details_text),
|
||||
'default',
|
||||
$user);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($user)
|
||||
->addCancelButton($obj_handle->getURI())
|
||||
->setTitle(pht('Raw Comment'));
|
||||
->setTitle($title);
|
||||
|
||||
$dialog
|
||||
->addHiddenInput('anchor', $request->getStr('anchor'))
|
||||
|
@ -51,7 +77,10 @@ final class PhabricatorApplicationTransactionCommentRawController
|
|||
->appendChild(
|
||||
id(new AphrontFormTextAreaControl())
|
||||
->setReadOnly(true)
|
||||
->setValue($xaction->getComment()->getContent())));
|
||||
->setValue($body)));
|
||||
if ($addendum) {
|
||||
$dialog->appendParagraph($addendum);
|
||||
}
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
|
|
@ -539,6 +539,23 @@ final class PHUITimelineEventView extends AphrontView {
|
|||
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) {
|
||||
$items[] = id(new PhabricatorActionView())
|
||||
->setIcon('fa-envelope-o')
|
||||
->setHref('/transactions/raw/'.$xaction_phid.'/?email')
|
||||
->setName(pht('View Email Body'))
|
||||
->addSigil('transaction-raw')
|
||||
->setMetadata(
|
||||
array(
|
||||
'anchor' => $anchor,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->getIsRemovable()) {
|
||||
|
|
Loading…
Reference in a new issue