mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
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
This commit is contained in:
parent
96fe8c0b83
commit
61a92df66e
5 changed files with 57 additions and 1 deletions
|
@ -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',
|
||||
|
|
|
@ -194,7 +194,7 @@ final class PhabricatorBadgesEditor
|
|||
$body = parent::buildMailBody($object, $xactions);
|
||||
|
||||
if (strlen($description)) {
|
||||
$body->addRemarkupSeciton(
|
||||
$body->addRemarkupSection(
|
||||
pht('BADGE DESCRIPTION'),
|
||||
$object->getDescription());
|
||||
}
|
||||
|
|
|
@ -262,4 +262,9 @@ final class PhabricatorPhurlURLEditor
|
|||
throw new PhabricatorApplicationTransactionValidationException($errors);
|
||||
}
|
||||
|
||||
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
|
||||
return id(new PhabricatorPhurlURLReplyHandler())
|
||||
->setMailReceiver($object);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorPhurlURLMailReceiver
|
||||
extends PhabricatorObjectMailReceiver {
|
||||
|
||||
public function isEnabled() {
|
||||
return PhabricatorApplication::isClassInstalled(
|
||||
'PhabricatorPhurlApplication');
|
||||
}
|
||||
|
||||
protected function getObjectPattern() {
|
||||
return 'U[1-9]\d*';
|
||||
}
|
||||
|
||||
protected function loadObject($pattern, PhabricatorUser $viewer) {
|
||||
$id = (int)substr($pattern, 1);
|
||||
|
||||
return id(new PhabricatorPhurlURLQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
}
|
||||
|
||||
protected function getTransactionReplyHandler() {
|
||||
return new PhabricatorPhurlURLReplyHandler();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorPhurlURLReplyHandler
|
||||
extends PhabricatorApplicationTransactionReplyHandler {
|
||||
|
||||
public function validateMailReceiver($mail_receiver) {
|
||||
if (!($mail_receiver instanceof PhabricatorPhurlURL)) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'Mail receiver is not a %s!',
|
||||
'PhabricatorPhurlURL'));
|
||||
}
|
||||
}
|
||||
|
||||
public function getObjectPrefix() {
|
||||
return 'U';
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue