3 final class ManiphestAssignEmailCommand
4 extends ManiphestEmailCommand
{
6 public function getCommand() {
10 public function getCommandSyntax() {
11 return '**!assign** //username//';
14 public function getCommandSummary() {
15 return pht('Assign a task to a specific user.');
18 public function getCommandDescription() {
20 "To assign a task to another user, provide their username. For example, ".
21 "to assign a task to `%s`, write `%s`.\n\n".
22 "If you omit the username or the username is not valid, this behaves ".
23 "like `%s` and assigns the task to you instead.",
29 public function buildTransactions(
30 PhabricatorUser
$viewer,
31 PhabricatorApplicationTransactionInterface
$object,
32 PhabricatorMetaMTAReceivedMail
$mail,
39 $assign_to = head($argv);
41 $assign_user = id(new PhabricatorPeopleQuery())
43 ->withUsernames(array($assign_to))
46 $assign_phid = $assign_user->getPHID();
50 // Treat bad "!assign" like "!claim".
52 $assign_phid = $viewer->getPHID();
55 $xactions[] = $object->getApplicationTransactionTemplate()
56 ->setTransactionType(ManiphestTaskOwnerTransaction
::TRANSACTIONTYPE
)
57 ->setNewValue($assign_phid);