Provide a way to view MetaMTA messages by status

Summary:
Added a query option of status for the MetaMTA list controller. There currently
isn't a ui for accessing this.

Task ID: #

Blame Rev:

Test Plan:
loaded /mail/, /mail/?status=queued, /mail?phid=PHID...&status=...
each request returned a sane list of data

Revert Plan:

Tags:

Reviewers: epriestley, btrahan, jungejason

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1784
This commit is contained in:
Nick Harper
2012-03-05 11:22:51 -08:00
parent f5f7987013
commit 8f27f4272c

View File

@@ -1,7 +1,7 @@
<?php <?php
/* /*
* Copyright 2011 Facebook, Inc. * Copyright 2012 Facebook, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ class PhabricatorMetaMTAListController extends PhabricatorMetaMTAController {
$user = $request->getUser(); $user = $request->getUser();
$offset = $request->getInt('offset', 0); $offset = $request->getInt('offset', 0);
$related_phid = $request->getStr('phid'); $related_phid = $request->getStr('phid');
$status = $request->getStr('status');
$pager = new AphrontPagerView(); $pager = new AphrontPagerView();
$pager->setOffset($offset); $pager->setOffset($offset);
@@ -32,11 +33,21 @@ class PhabricatorMetaMTAListController extends PhabricatorMetaMTAController {
$mail = new PhabricatorMetaMTAMail(); $mail = new PhabricatorMetaMTAMail();
$conn_r = $mail->establishConnection('r'); $conn_r = $mail->establishConnection('r');
if ($related_phid) { $wheres = array();
$where_clause = qsprintf( if ($status) {
$wheres[] = qsprintf(
$conn_r, $conn_r,
'WHERE relatedPHID = %s', 'status = %s',
$status);
}
if ($related_phid) {
$wheres[] = qsprintf(
$conn_r,
'relatedPHID = %s',
$related_phid); $related_phid);
}
if (count($wheres)) {
$where_clause = 'WHERE '.implode($wheres, ' AND ');
} else { } else {
$where_clause = 'WHERE 1 = 1'; $where_clause = 'WHERE 1 = 1';
} }