Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php b/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php
index 859b2baf88..938e6f656c 100644
--- a/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php
+++ b/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php
@@ -1,91 +1,111 @@
<?php
final class PhabricatorMetaMTAMailViewController
extends PhabricatorMetaMTAController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$mail = id(new PhabricatorMetaMTAMailQuery())
->setViewer($viewer)
->withIDs(array($request->getURIData('id')))
->executeOne();
if (!$mail) {
return new Aphront404Response();
}
if ($mail->hasSensitiveContent()) {
$title = pht('Content Redacted');
} else {
$title = $mail->getSubject();
}
$header = id(new PHUIHeaderView())
->setHeader($title)
->setUser($this->getRequest()->getUser())
->setPolicyObject($mail);
$crumbs = $this->buildApplicationCrumbs()
->addTextCrumb(
'Mail '.$mail->getID());
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($this->buildPropertyView($mail));
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
'pageObjects' => array($mail->getPHID()),
));
}
private function buildPropertyView(PhabricatorMetaMTAMail $mail) {
$viewer = $this->getViewer();
$properties = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($mail);
+ $properties->addProperty(
+ pht('ID'),
+ $mail->getID());
+
+ $properties->addProperty(
+ pht('Status'),
+ $mail->getStatus());
+
+ if ($mail->getMessage()) {
+ $properties->addProperty(
+ pht('Status Details'),
+ $mail->getMessage());
+ }
+
+ if ($mail->getRelatedPHID()) {
+ $properties->addProperty(
+ pht('Related Object'),
+ $viewer->renderHandle($mail->getRelatedPHID()));
+ }
+
if ($mail->getActorPHID()) {
$actor_str = $viewer->renderHandle($mail->getActorPHID());
} else {
$actor_str = pht('Generated by Phabricator');
}
$properties->addProperty(
pht('Actor'),
$actor_str);
if ($mail->getFrom()) {
$from_str = $viewer->renderHandle($mail->getFrom());
} else {
$from_str = pht('Sent by Phabricator');
}
$properties->addProperty(
pht('From'),
$from_str);
if ($mail->getToPHIDs()) {
$to_list = $viewer->renderHandleList($mail->getToPHIDs());
} else {
$to_list = pht('None');
}
$properties->addProperty(
pht('To'),
$to_list);
if ($mail->getCcPHIDs()) {
$cc_list = $viewer->renderHandleList($mail->getCcPHIDs());
} else {
$cc_list = pht('None');
}
$properties->addProperty(
pht('Cc'),
$cc_list);
return $properties;
}
}
diff --git a/src/applications/metamta/query/PhabricatorMetaMTAMailSearchEngine.php b/src/applications/metamta/query/PhabricatorMetaMTAMailSearchEngine.php
index 04055e756b..982189de91 100644
--- a/src/applications/metamta/query/PhabricatorMetaMTAMailSearchEngine.php
+++ b/src/applications/metamta/query/PhabricatorMetaMTAMailSearchEngine.php
@@ -1,123 +1,121 @@
<?php
final class PhabricatorMetaMTAMailSearchEngine
extends PhabricatorApplicationSearchEngine {
public function getResultTypeDescription() {
return pht('MetaMTA Mails');
}
public function getApplicationClassName() {
return 'PhabricatorMetaMTAApplication';
}
public function newQuery() {
return new PhabricatorMetaMTAMailQuery();
}
protected function shouldShowOrderField() {
return false;
}
protected function buildCustomSearchFields() {
return array(
id(new PhabricatorSearchUsersField())
->setLabel(pht('Actors'))
->setKey('actorPHIDs')
->setAliases(array('actor', 'actors')),
id(new PhabricatorSearchUsersField())
->setLabel(pht('Recipients'))
->setKey('recipientPHIDs')
->setAliases(array('recipient', 'recipients')),
);
}
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
if ($map['actorPHIDs']) {
$query->withActorPHIDs($map['actorPHIDs']);
}
if ($map['recipientPHIDs']) {
$query->withRecipientPHIDs($map['recipientPHIDs']);
}
return $query;
}
protected function getURI($path) {
return '/mail/'.$path;
}
protected function getBuiltinQueryNames() {
$names = array(
'inbox' => pht('Inbox'),
'outbox' => pht('Outbox'),
);
return $names;
}
public function buildSavedQueryFromBuiltin($query_key) {
$viewer = $this->requireViewer();
$query = $this->newSavedQuery();
$query->setQueryKey($query_key);
switch ($query_key) {
case 'inbox':
return $query->setParameter(
'recipientPHIDs',
array($viewer->getPHID()));
case 'outbox':
return $query->setParameter(
'actorPHIDs',
array($viewer->getPHID()));
}
return parent::buildSavedQueryFromBuiltin($query_key);
}
protected function getRequiredHandlePHIDsForResultList(
array $objects,
PhabricatorSavedQuery $query) {
$phids = array();
foreach ($objects as $mail) {
$phids[] = $mail->getExpandedRecipientPHIDs();
}
return array_mergev($phids);
}
protected function renderResultList(
array $mails,
PhabricatorSavedQuery $query,
array $handles) {
assert_instances_of($mails, 'PhabricatorMetaMTAMail');
$viewer = $this->requireViewer();
$list = new PHUIObjectItemListView();
foreach ($mails as $mail) {
if ($mail->hasSensitiveContent()) {
- $header = pht(
- 'Mail %d: < content redacted >',
- $mail->getID());
+ $header = pht('< content redacted >');
} else {
- $header = pht(
- 'Mail %d: %s',
- $mail->getID(),
- $mail->getSubject());
+ $header = $mail->getSubject();
}
$item = id(new PHUIObjectItemView())
+ ->setUser($viewer)
->setObject($mail)
+ ->setEpoch($mail->getDateCreated())
+ ->setObjectName('Mail '.$mail->getID())
->setHeader($header)
->setHref($this->getURI('detail/'.$mail->getID()));
$list->addItem($item);
}
return $list;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, Jun 11, 12:21 AM (19 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
141462
Default Alt Text
(6 KB)

Event Timeline