@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

Fix two issues with Phurl / Badges mail generation

Summary:
- Phurl is missing a ReplyHandler / MailReceiver (all of this code should get cleaned up eventually, but I don't plan to get to it for a while).
- Badges has a bad call.

This should clean up some bad daemon tasks.

Test Plan: Saw fewer daemon errors after these changes.

Reviewers: chad

Reviewed By: chad

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

+57 -1
+4
src/__phutil_library_map__.php
··· 2766 2766 'PhabricatorPhurlURLEditController' => 'applications/phurl/controller/PhabricatorPhurlURLEditController.php', 2767 2767 'PhabricatorPhurlURLEditor' => 'applications/phurl/editor/PhabricatorPhurlURLEditor.php', 2768 2768 'PhabricatorPhurlURLListController' => 'applications/phurl/controller/PhabricatorPhurlURLListController.php', 2769 + 'PhabricatorPhurlURLMailReceiver' => 'applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php', 2769 2770 'PhabricatorPhurlURLPHIDType' => 'applications/phurl/phid/PhabricatorPhurlURLPHIDType.php', 2770 2771 'PhabricatorPhurlURLQuery' => 'applications/phurl/query/PhabricatorPhurlURLQuery.php', 2772 + 'PhabricatorPhurlURLReplyHandler' => 'applications/phurl/mail/PhabricatorPhurlURLReplyHandler.php', 2771 2773 'PhabricatorPhurlURLSearchEngine' => 'applications/phurl/query/PhabricatorPhurlURLSearchEngine.php', 2772 2774 'PhabricatorPhurlURLTransaction' => 'applications/phurl/storage/PhabricatorPhurlURLTransaction.php', 2773 2775 'PhabricatorPhurlURLTransactionComment' => 'applications/phurl/storage/PhabricatorPhurlURLTransactionComment.php', ··· 7069 7071 'PhabricatorPhurlURLEditController' => 'PhabricatorPhurlController', 7070 7072 'PhabricatorPhurlURLEditor' => 'PhabricatorApplicationTransactionEditor', 7071 7073 'PhabricatorPhurlURLListController' => 'PhabricatorPhurlController', 7074 + 'PhabricatorPhurlURLMailReceiver' => 'PhabricatorObjectMailReceiver', 7072 7075 'PhabricatorPhurlURLPHIDType' => 'PhabricatorPHIDType', 7073 7076 'PhabricatorPhurlURLQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 7077 + 'PhabricatorPhurlURLReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 7074 7078 'PhabricatorPhurlURLSearchEngine' => 'PhabricatorApplicationSearchEngine', 7075 7079 'PhabricatorPhurlURLTransaction' => 'PhabricatorApplicationTransaction', 7076 7080 'PhabricatorPhurlURLTransactionComment' => 'PhabricatorApplicationTransactionComment',
+1 -1
src/applications/badges/editor/PhabricatorBadgesEditor.php
··· 194 194 $body = parent::buildMailBody($object, $xactions); 195 195 196 196 if (strlen($description)) { 197 - $body->addRemarkupSeciton( 197 + $body->addRemarkupSection( 198 198 pht('BADGE DESCRIPTION'), 199 199 $object->getDescription()); 200 200 }
+5
src/applications/phurl/editor/PhabricatorPhurlURLEditor.php
··· 262 262 throw new PhabricatorApplicationTransactionValidationException($errors); 263 263 } 264 264 265 + protected function buildReplyHandler(PhabricatorLiskDAO $object) { 266 + return id(new PhabricatorPhurlURLReplyHandler()) 267 + ->setMailReceiver($object); 268 + } 269 + 265 270 }
+28
src/applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php
··· 1 + <?php 2 + 3 + final class PhabricatorPhurlURLMailReceiver 4 + extends PhabricatorObjectMailReceiver { 5 + 6 + public function isEnabled() { 7 + return PhabricatorApplication::isClassInstalled( 8 + 'PhabricatorPhurlApplication'); 9 + } 10 + 11 + protected function getObjectPattern() { 12 + return 'U[1-9]\d*'; 13 + } 14 + 15 + protected function loadObject($pattern, PhabricatorUser $viewer) { 16 + $id = (int)substr($pattern, 1); 17 + 18 + return id(new PhabricatorPhurlURLQuery()) 19 + ->setViewer($viewer) 20 + ->withIDs(array($id)) 21 + ->executeOne(); 22 + } 23 + 24 + protected function getTransactionReplyHandler() { 25 + return new PhabricatorPhurlURLReplyHandler(); 26 + } 27 + 28 + }
+19
src/applications/phurl/mail/PhabricatorPhurlURLReplyHandler.php
··· 1 + <?php 2 + 3 + final class PhabricatorPhurlURLReplyHandler 4 + extends PhabricatorApplicationTransactionReplyHandler { 5 + 6 + public function validateMailReceiver($mail_receiver) { 7 + if (!($mail_receiver instanceof PhabricatorPhurlURL)) { 8 + throw new Exception( 9 + pht( 10 + 'Mail receiver is not a %s!', 11 + 'PhabricatorPhurlURL')); 12 + } 13 + } 14 + 15 + public function getObjectPrefix() { 16 + return 'U'; 17 + } 18 + 19 + }