@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Modernize MetaMTA

Summary:
- Add an Application.
- Move routes to the application.
- Move nav out of tabs (which no longer exist).
- Fix a couple of random things.

Test Plan: Viewed sent/received mail logs. Performed send/receive tests. Viewed email details.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T631, T1569

Differential Revision: https://secure.phabricator.com/D3255

+108 -68
+2
src/__phutil_library_map__.php
··· 553 553 'PhabricatorApplicationLaunchView' => 'applications/meta/view/PhabricatorApplicationLaunchView.php', 554 554 'PhabricatorApplicationMailingLists' => 'applications/mailinglists/application/PhabricatorApplicationMailingLists.php', 555 555 'PhabricatorApplicationManiphest' => 'applications/maniphest/application/PhabricatorApplicationManiphest.php', 556 + 'PhabricatorApplicationMetaMTA' => 'applications/metamta/application/PhabricatorApplicationMetaMTA.php', 556 557 'PhabricatorApplicationPeople' => 'applications/people/application/PhabricatorApplicationPeople.php', 557 558 'PhabricatorApplicationPhriction' => 'applications/phriction/application/PhabricatorApplicationPhriction.php', 558 559 'PhabricatorApplicationPonder' => 'applications/ponder/application/PhabricatorApplicationPonder.php', ··· 1673 1674 'PhabricatorApplicationLaunchView' => 'AphrontView', 1674 1675 'PhabricatorApplicationMailingLists' => 'PhabricatorApplication', 1675 1676 'PhabricatorApplicationManiphest' => 'PhabricatorApplication', 1677 + 'PhabricatorApplicationMetaMTA' => 'PhabricatorApplication', 1676 1678 'PhabricatorApplicationPeople' => 'PhabricatorApplication', 1677 1679 'PhabricatorApplicationPhriction' => 'PhabricatorApplication', 1678 1680 'PhabricatorApplicationPonder' => 'PhabricatorApplication',
-9
src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
··· 81 81 => 'PhabricatorTypeaheadCommonDatasourceController', 82 82 ), 83 83 84 - '/mail/' => array( 85 - '' => 'PhabricatorMetaMTAListController', 86 - 'send/' => 'PhabricatorMetaMTASendController', 87 - 'view/(?P<id>\d+)/' => 'PhabricatorMetaMTAViewController', 88 - 'receive/' => 'PhabricatorMetaMTAReceiveController', 89 - 'received/' => 'PhabricatorMetaMTAReceivedListController', 90 - 'sendgrid/' => 'PhabricatorMetaMTASendGridReceiveController', 91 - ), 92 - 93 84 '/login/' => array( 94 85 '' => 'PhabricatorLoginController', 95 86 'email/' => 'PhabricatorEmailLoginController',
+8 -7
src/applications/base/controller/PhabricatorController.php
··· 149 149 150 150 if (!($view instanceof AphrontSideNavFilterView)) { 151 151 $nav = new AphrontSideNavFilterView(); 152 - if ($application) { 153 - $nav->setCurrentApplication($application); 154 - } 155 - $nav->setUser($this->getRequest()->getUser()); 156 - $nav->setFlexNav(true); 157 - $nav->setShowApplicationMenu(true); 158 152 $nav->appendChild($view); 153 + $view = $nav; 154 + } 159 155 160 - $view = $nav; 156 + if ($application) { 157 + $view->setCurrentApplication($application); 161 158 } 159 + 160 + $view->setUser($this->getRequest()->getUser()); 161 + $view->setFlexNav(true); 162 + $view->setShowApplicationMenu(true); 162 163 163 164 $page->appendChild($view); 164 165
+46
src/applications/metamta/application/PhabricatorApplicationMetaMTA.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + final class PhabricatorApplicationMetaMTA extends PhabricatorApplication { 20 + 21 + public function getBaseURI() { 22 + return '/mail/'; 23 + } 24 + 25 + public function getShortDescription() { 26 + return 'View Mail Logs'; 27 + } 28 + 29 + public function getRoutes() { 30 + return array( 31 + $this->getBaseURI() => array( 32 + '' => 'PhabricatorMetaMTAListController', 33 + 'send/' => 'PhabricatorMetaMTASendController', 34 + 'view/(?P<id>\d+)/' => 'PhabricatorMetaMTAViewController', 35 + 'receive/' => 'PhabricatorMetaMTAReceiveController', 36 + 'received/' => 'PhabricatorMetaMTAReceivedListController', 37 + 'sendgrid/' => 'PhabricatorMetaMTASendGridReceiveController', 38 + ), 39 + ); 40 + } 41 + 42 + public function getTitleGlyph() { 43 + return '@'; 44 + } 45 + 46 + }
+16 -26
src/applications/metamta/controller/PhabricatorMetaMTAController.php
··· 1 1 <?php 2 2 3 3 /* 4 - * Copyright 2011 Facebook, Inc. 4 + * Copyright 2012 Facebook, Inc. 5 5 * 6 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 7 * you may not use this file except in compliance with the License. ··· 22 22 return true; 23 23 } 24 24 25 - public function buildStandardPageResponse($view, array $data) { 26 - $page = $this->buildStandardPageView(); 25 + public function buildSideNavView() { 26 + $nav = new AphrontSideNavFilterView(); 27 + $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 27 28 28 - $page->setApplicationName('MetaMTA'); 29 - $page->setBaseURI('/mail/'); 30 - $page->setTitle(idx($data, 'title')); 31 - $page->setTabs( 32 - array( 33 - 'queue' => array( 34 - 'name' => 'Mail Queue', 35 - 'href' => '/mail/', 36 - ), 37 - 'lists' => array( 38 - 'name' => 'Mailing Lists', 39 - 'href' => '/mail/lists/', 40 - ), 41 - 'received' => array( 42 - 'name' => 'Received', 43 - 'href' => '/mail/received/', 44 - ), 45 - ), 46 - idx($data, 'tab')); 47 - $page->setGlyph("@"); 48 - $page->appendChild($view); 29 + $nav->addLabel('Mail Logs'); 30 + $nav->addFilter('sent', 'Sent Mail', $this->getApplicationURI()); 31 + $nav->addFilter('received', 'Received Mail'); 32 + 33 + $nav->addSpacer(); 34 + 35 + if ($this->getRequest()->getUser()->getIsAdmin()) { 36 + $nav->addLabel('Diagnostics'); 37 + $nav->addFilter('send', 'Send Test'); 38 + $nav->addFilter('receive', 'Receive Test'); 39 + } 49 40 50 - $response = new AphrontWebpageResponse(); 51 - return $response->setContent($page->render()); 41 + return $nav; 52 42 } 53 43 54 44 }
+8 -8
src/applications/metamta/controller/PhabricatorMetaMTAListController.php
··· 88 88 'a', 89 89 array( 90 90 'class' => 'button small grey', 91 - 'href' => '/mail/view/'.$mail->getID().'/', 91 + 'href' => $this->getApplicationURI('/view/'.$mail->getID().'/'), 92 92 ), 93 93 'View'), 94 94 ); ··· 120 120 $panel = new AphrontPanelView(); 121 121 $panel->appendChild($table); 122 122 $panel->setHeader('MetaMTA Messages'); 123 - if ($user->getIsAdmin()) { 124 - $panel->setCreateButton('Send New Test Message', '/mail/send/'); 125 - } 126 123 $panel->appendChild($pager); 127 124 128 - return $this->buildStandardPageResponse( 129 - $panel, 125 + $nav = $this->buildSideNavView(); 126 + $nav->selectFilter('sent'); 127 + $nav->appendChild($panel); 128 + 129 + return $this->buildApplicationPage( 130 + $nav, 130 131 array( 131 - 'title' => 'MetaMTA', 132 - 'tab' => 'queue', 132 + 'title' => 'Sent Mail', 133 133 )); 134 134 } 135 135 }
+9 -5
src/applications/metamta/controller/PhabricatorMetaMTAReceiveController.php
··· 58 58 59 59 $form = new AphrontFormView(); 60 60 $form->setUser($request->getUser()); 61 - $form->setAction('/mail/receive/'); 61 + $form->setAction($this->getApplicationURI('/receive/')); 62 62 $form 63 63 ->appendChild( 64 64 '<p class="aphront-form-instructions">This form will simulate '. ··· 79 79 $panel = new AphrontPanelView(); 80 80 $panel->setHeader('Receive Email'); 81 81 $panel->appendChild($form); 82 - $panel->setWidth(AphrontPanelView::WIDTH_WIDE); 82 + $panel->setWidth(AphrontPanelView::WIDTH_FORM); 83 83 84 - return $this->buildStandardPageResponse( 85 - $panel, 84 + $nav = $this->buildSideNavView(); 85 + $nav->selectFilter('receive'); 86 + $nav->appendChild($panel); 87 + 88 + return $this->buildApplicationPage( 89 + $nav, 86 90 array( 87 - 'title' => 'Receive Mail', 91 + 'title' => 'Receive Test', 88 92 )); 89 93 } 90 94
+6 -3
src/applications/metamta/controller/PhabricatorMetaMTAReceivedListController.php
··· 80 80 81 81 $panel = new AphrontPanelView(); 82 82 $panel->setHeader('Received Mail'); 83 - $panel->setCreateButton('Test Receiver', '/mail/receive/'); 84 83 $panel->appendChild($table); 85 84 $panel->appendChild($pager); 86 85 87 - return $this->buildStandardPageResponse( 88 - $panel, 86 + $nav = $this->buildSideNavView(); 87 + $nav->selectFilter('received'); 88 + $nav->appendChild($panel); 89 + 90 + return $this->buildApplicationPage( 91 + $nav, 89 92 array( 90 93 'title' => 'Received Mail', 91 94 'tab' => 'received',
+11 -7
src/applications/metamta/controller/PhabricatorMetaMTASendController.php
··· 54 54 } 55 55 56 56 return id(new AphrontRedirectResponse()) 57 - ->setURI('/mail/view/'.$mail->getID().'/'); 57 + ->setURI($this->getApplicationURI('/view/'.$mail->getID().'/')); 58 58 } 59 59 60 60 $failure_caption = ··· 94 94 95 95 $form = new AphrontFormView(); 96 96 $form->setUser($request->getUser()); 97 - $form->setAction('/mail/send/'); 98 97 $form 99 98 ->appendChild($instructions) 100 99 ->appendChild( 101 100 id(new AphrontFormStaticControl()) 102 - ->setLabel('Configured Adapter') 101 + ->setLabel('Adapter') 103 102 ->setValue($adapter)) 104 103 ->appendChild( 105 104 id(new AphrontFormTokenizerControl()) ··· 159 158 $panel->setHeader('Send Email'); 160 159 $panel->appendChild($form); 161 160 $panel->setID($panel_id); 162 - $panel->setWidth(AphrontPanelView::WIDTH_WIDE); 161 + $panel->setWidth(AphrontPanelView::WIDTH_FORM); 163 162 164 - return $this->buildStandardPageResponse( 163 + $nav = $this->buildSideNavView(); 164 + $nav->selectFilter('send'); 165 + $nav->appendChild( 165 166 array( 166 167 $warning, 167 168 $panel, 168 - ), 169 + )); 170 + 171 + return $this->buildApplicationPage( 172 + $nav, 169 173 array( 170 - 'title' => 'Send Mail', 174 + 'title' => 'Send Test', 171 175 )); 172 176 } 173 177
+2 -3
src/applications/metamta/controller/PhabricatorMetaMTAViewController.php
··· 39 39 40 40 $form = new AphrontFormView(); 41 41 $form->setUser($request->getUser()); 42 - $form->setAction('/mail/send/'); 43 42 $form 44 43 ->appendChild( 45 44 id(new AphrontFormStaticControl()) ··· 67 66 ->setValue($mail->getRelatedPHID())) 68 67 ->appendChild( 69 68 id(new AphrontFormSubmitControl()) 70 - ->addCancelButton('/mail/', 'Done')); 69 + ->addCancelButton($this->getApplicationURI(), 'Done')); 71 70 72 71 $panel = new AphrontPanelView(); 73 72 $panel->setHeader('View Email'); 74 73 $panel->appendChild($form); 75 74 $panel->setWidth(AphrontPanelView::WIDTH_WIDE); 76 75 77 - return $this->buildStandardPageResponse( 76 + return $this->buildApplicationPage( 78 77 $panel, 79 78 array( 80 79 'title' => 'View Mail',