1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-20 13:52:40 +01:00

Modernize MetaMTA message detail

Summary: Ref T3306. I'm going to add more information about To/Cc here, but here's a little cleanup first.

Test Plan: {F49524}

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

Maniphest Tasks: T3306

Differential Revision: https://secure.phabricator.com/D6410
This commit is contained in:
epriestley 2013-07-10 15:13:33 -07:00
parent 7fa2343822
commit a92ef7d9a2

View file

@ -19,51 +19,65 @@ final class PhabricatorMetaMTAViewController
return new Aphront404Response();
}
$status = PhabricatorMetaMTAMail::getReadableStatus($mail->getStatus());
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addCrumb(
id(new PhabricatorCrumbView())
->setName(pht('Mail %d', $mail->getID())));
$form = new AphrontFormView();
$form->setUser($request->getUser());
$form
->appendChild(
id(new AphrontFormStaticControl())
->setLabel(pht('Subject'))
->setValue($mail->getSubject()))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel(pht('Created'))
->setValue(phabricator_datetime($mail->getDateCreated(), $user)))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel(pht('Status'))
->setValue($status))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel(pht('Retry Count'))
->setValue($mail->getRetryCount()))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel(pht('Message'))
->setValue($mail->getMessage()))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel(pht('Related PHID'))
->setValue($mail->getRelatedPHID()))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton($this->getApplicationURI(), pht('Done')));
$header = id(new PhabricatorHeaderView())
->setHeader(pht('Mail: %s', $mail->getSubject()));
$panel = new AphrontPanelView();
$panel->setHeader(pht('View Email'));
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
$panel->setNoBackground();
$properties = $this->buildPropertyListView($mail);
return $this->buildApplicationPage(
$panel,
array(
$crumbs,
$header,
$properties,
),
array(
'title' => pht('View Mail'),
'device' => true,
'dust' => true,
));
}
private function buildPropertyListView(PhabricatorMetaMTAMail $mail) {
$viewer = $this->getRequest()->getUser();
$related_phid = $mail->getRelatedPHID();
$view = id(new PhabricatorPropertyListView())
->setUser($viewer);
$view->addProperty(
pht('Status'),
PhabricatorMetaMTAMail::getReadableStatus($mail->getStatus()));
$view->addProperty(
pht('Retry Count'),
$mail->getRetryCount());
$view->addProperty(
pht('Delivery Message'),
nonempty($mail->getMessage(), '-'));
$view->addProperty(
pht('Created'),
phabricator_datetime($mail->getDateCreated(), $viewer));
$phids = array();
$phids[] = $related_phid;
$handles = $this->loadViewerHandles($phids);
if ($related_phid) {
$related_object = $handles[$related_phid]->renderLink();
} else {
$related_object = phutil_tag('em', array(), pht('None'));
}
$view->addProperty(pht('Related Object'), $related_object);
return $view;
}
}