From a92ef7d9a2d3f25f2811d238afd8971854f5836c Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 10 Jul 2013 15:13:33 -0700 Subject: [PATCH] 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 --- .../PhabricatorMetaMTAViewController.php | 88 +++++++++++-------- 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAViewController.php b/src/applications/metamta/controller/PhabricatorMetaMTAViewController.php index 537678c381..c0a2576b66 100644 --- a/src/applications/metamta/controller/PhabricatorMetaMTAViewController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTAViewController.php @@ -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; + } }