From 61a92df66e205c181e67fcdc21ab8e9491e6ebe1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 22 Dec 2015 08:05:56 -0800 Subject: [PATCH] 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 --- src/__phutil_library_map__.php | 4 +++ .../badges/editor/PhabricatorBadgesEditor.php | 2 +- .../editor/PhabricatorPhurlURLEditor.php | 5 ++++ .../mail/PhabricatorPhurlURLMailReceiver.php | 28 +++++++++++++++++++ .../mail/PhabricatorPhurlURLReplyHandler.php | 19 +++++++++++++ 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php create mode 100644 src/applications/phurl/mail/PhabricatorPhurlURLReplyHandler.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 20e0f494fd..3e763cffe8 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2766,8 +2766,10 @@ phutil_register_library_map(array( 'PhabricatorPhurlURLEditController' => 'applications/phurl/controller/PhabricatorPhurlURLEditController.php', 'PhabricatorPhurlURLEditor' => 'applications/phurl/editor/PhabricatorPhurlURLEditor.php', 'PhabricatorPhurlURLListController' => 'applications/phurl/controller/PhabricatorPhurlURLListController.php', + 'PhabricatorPhurlURLMailReceiver' => 'applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php', 'PhabricatorPhurlURLPHIDType' => 'applications/phurl/phid/PhabricatorPhurlURLPHIDType.php', 'PhabricatorPhurlURLQuery' => 'applications/phurl/query/PhabricatorPhurlURLQuery.php', + 'PhabricatorPhurlURLReplyHandler' => 'applications/phurl/mail/PhabricatorPhurlURLReplyHandler.php', 'PhabricatorPhurlURLSearchEngine' => 'applications/phurl/query/PhabricatorPhurlURLSearchEngine.php', 'PhabricatorPhurlURLTransaction' => 'applications/phurl/storage/PhabricatorPhurlURLTransaction.php', 'PhabricatorPhurlURLTransactionComment' => 'applications/phurl/storage/PhabricatorPhurlURLTransactionComment.php', @@ -7069,8 +7071,10 @@ phutil_register_library_map(array( 'PhabricatorPhurlURLEditController' => 'PhabricatorPhurlController', 'PhabricatorPhurlURLEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorPhurlURLListController' => 'PhabricatorPhurlController', + 'PhabricatorPhurlURLMailReceiver' => 'PhabricatorObjectMailReceiver', 'PhabricatorPhurlURLPHIDType' => 'PhabricatorPHIDType', 'PhabricatorPhurlURLQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', + 'PhabricatorPhurlURLReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 'PhabricatorPhurlURLSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorPhurlURLTransaction' => 'PhabricatorApplicationTransaction', 'PhabricatorPhurlURLTransactionComment' => 'PhabricatorApplicationTransactionComment', diff --git a/src/applications/badges/editor/PhabricatorBadgesEditor.php b/src/applications/badges/editor/PhabricatorBadgesEditor.php index ad4ccca3d2..fd0b14ad46 100644 --- a/src/applications/badges/editor/PhabricatorBadgesEditor.php +++ b/src/applications/badges/editor/PhabricatorBadgesEditor.php @@ -194,7 +194,7 @@ final class PhabricatorBadgesEditor $body = parent::buildMailBody($object, $xactions); if (strlen($description)) { - $body->addRemarkupSeciton( + $body->addRemarkupSection( pht('BADGE DESCRIPTION'), $object->getDescription()); } diff --git a/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php b/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php index c36100f12b..64cfe6046b 100644 --- a/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php +++ b/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php @@ -262,4 +262,9 @@ final class PhabricatorPhurlURLEditor throw new PhabricatorApplicationTransactionValidationException($errors); } + protected function buildReplyHandler(PhabricatorLiskDAO $object) { + return id(new PhabricatorPhurlURLReplyHandler()) + ->setMailReceiver($object); + } + } diff --git a/src/applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php b/src/applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php new file mode 100644 index 0000000000..14a953bc31 --- /dev/null +++ b/src/applications/phurl/mail/PhabricatorPhurlURLMailReceiver.php @@ -0,0 +1,28 @@ +setViewer($viewer) + ->withIDs(array($id)) + ->executeOne(); + } + + protected function getTransactionReplyHandler() { + return new PhabricatorPhurlURLReplyHandler(); + } + +} diff --git a/src/applications/phurl/mail/PhabricatorPhurlURLReplyHandler.php b/src/applications/phurl/mail/PhabricatorPhurlURLReplyHandler.php new file mode 100644 index 0000000000..c15394ffcf --- /dev/null +++ b/src/applications/phurl/mail/PhabricatorPhurlURLReplyHandler.php @@ -0,0 +1,19 @@ +