3 final class PhabricatorSubscriptionsSubscribeEmailCommand
4 extends MetaMTAEmailTransactionCommand
{
6 public function getCommand() {
10 public function getCommandSyntax() {
11 return '**!subscribe** //username #project ...//';
14 public function getCommandSummary() {
15 return pht('Add users or projects as subscribers.');
18 public function getCommandDescription() {
20 'Add one or more subscribers to the object. You can add users by '.
21 'providing their usernames, or add projects by adding their hashtags. '.
22 'For example, use `%s` to add the user `alincoln` and the project with '.
23 'hashtag `#ios` as subscribers.'.
25 'Subscribers which are invalid or unrecognized will be ignored. This '.
26 'command has no effect if you do not specify any subscribers.'.
28 'Users who are CC\'d on the email itself are also automatically '.
29 'subscribed if Phabricator knows which accounts are linked to their '.
31 '!subscribe alincoln #ios');
34 public function getCommandAliases() {
40 public function isCommandSupportedForObject(
41 PhabricatorApplicationTransactionInterface
$object) {
42 return ($object instanceof PhabricatorSubscribableInterface
);
45 public function buildTransactions(
46 PhabricatorUser
$viewer,
47 PhabricatorApplicationTransactionInterface
$object,
48 PhabricatorMetaMTAReceivedMail
$mail,
52 $subscriber_phids = id(new PhabricatorObjectListQuery())
56 PhabricatorPeopleUserPHIDType
::TYPECONST
,
57 PhabricatorProjectProjectPHIDType
::TYPECONST
,
59 ->setObjectList(implode(' ', $argv))
60 ->setAllowPartialResults(true)
65 $xactions[] = $object->getApplicationTransactionTemplate()
66 ->setTransactionType(PhabricatorTransactions
::TYPE_SUBSCRIBERS
)
69 '+' => array_fuse($subscriber_phids),