Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894649
PhabricatorSubscriptionsSubscribeEmailCommand.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorSubscriptionsSubscribeEmailCommand.php
View Options
<?php
final
class
PhabricatorSubscriptionsSubscribeEmailCommand
extends
MetaMTAEmailTransactionCommand
{
public
function
getCommand
(
)
{
return
'subscribe'
;
}
public
function
getCommandSyntax
(
)
{
return
'**!subscribe** //username #project ...//'
;
}
public
function
getCommandSummary
(
)
{
return
pht
(
'Add users or projects as subscribers.'
)
;
}
public
function
getCommandDescription
(
)
{
return
pht
(
'Add one or more subscribers to the object. You can add users by '
.
'providing their usernames, or add projects by adding their hashtags. '
.
'For example, use `%s` to add the user `alincoln` and the project with '
.
'hashtag `#ios` as subscribers.'
.
"\n\n"
.
'Subscribers which are invalid or unrecognized will be ignored. This '
.
'command has no effect if you do not specify any subscribers.'
.
"\n\n"
.
'Users who are CC\'d on the email itself are also automatically '
.
'subscribed if their addresses are associated with a known account.'
,
'!subscribe alincoln #ios'
)
;
}
public
function
getCommandAliases
(
)
{
return
array
(
'cc'
,
)
;
}
public
function
isCommandSupportedForObject
(
PhabricatorApplicationTransactionInterface
$object
)
{
return
(
$object
instanceof
PhabricatorSubscribableInterface
)
;
}
public
function
buildTransactions
(
PhabricatorUser
$viewer
,
PhabricatorApplicationTransactionInterface
$object
,
PhabricatorMetaMTAReceivedMail
$mail
,
$command
,
array
$argv
)
{
$subscriber_phids
=
id
(
new
PhabricatorObjectListQuery
(
)
)
->
setViewer
(
$viewer
)
->
setAllowedTypes
(
array
(
PhabricatorPeopleUserPHIDType
::
TYPECONST
,
PhabricatorProjectProjectPHIDType
::
TYPECONST
,
)
)
->
setObjectList
(
implode
(
' '
,
$argv
)
)
->
setAllowPartialResults
(
true
)
->
execute
(
)
;
$xactions
=
array
(
)
;
$xactions
[
]
=
$object
->
getApplicationTransactionTemplate
(
)
->
setTransactionType
(
PhabricatorTransactions
::
TYPE_SUBSCRIBERS
)
->
setNewValue
(
array
(
'+'
=>
array_fuse
(
$subscriber_phids
)
,
)
)
;
return
$xactions
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 20:13 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128340
Default Alt Text
PhabricatorSubscriptionsSubscribeEmailCommand.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment