mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-28 09:42:41 +01:00
eb81fd1562
Summary: Fixes T7199. This still isn't a shining example of perfect code, but the raw amount of copy/paste is much lower than it used to be. - Reduce code duplication between existing receivers. - Expose receiving objects in help menus where appropriate. - Connect some "TODO" receivers. Test Plan: - Sent mail to every supported object type. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7199 Differential Revision: https://secure.phabricator.com/D12249
27 lines
625 B
PHP
27 lines
625 B
PHP
<?php
|
|
|
|
final class PasteMailReceiver extends PhabricatorObjectMailReceiver {
|
|
|
|
public function isEnabled() {
|
|
$app_class = 'PhabricatorPasteApplication';
|
|
return PhabricatorApplication::isClassInstalled($app_class);
|
|
}
|
|
|
|
protected function getObjectPattern() {
|
|
return 'P[1-9]\d*';
|
|
}
|
|
|
|
protected function loadObject($pattern, PhabricatorUser $viewer) {
|
|
$id = (int)trim($pattern, 'P');
|
|
|
|
return id(new PhabricatorPasteQuery())
|
|
->setViewer($viewer)
|
|
->withIDs(array($id))
|
|
->executeOne();
|
|
}
|
|
|
|
protected function getTransactionReplyHandler() {
|
|
return new PasteReplyHandler();
|
|
}
|
|
|
|
}
|